Mercurial > cpython-lru_cache-weakref
annotate Python/getopt.c @ 87690:66c1c9f32567 default tip
Add use_weakref option to functools.lru_cache
The use_weakref option makes lru_cache create weak references to the function
arguments when creating the cache key, which prevents them from staying in the
memory forever even after all other references to them are gone.
This is a proof of concept for http://bugs.python.org/issue19859
| author | Radomir Dopieralski <devel@sheep.art.pl> |
|---|---|
| date | Tue, 03 Dec 2013 16:02:48 +0100 |
| parents | 654a628f5f00 |
| children |
| rev | line source |
|---|---|
|
1598
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
1 /*---------------------------------------------------------------------------* |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
2 * <RCS keywords> |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
3 * |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
4 * C++ Library |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
5 * |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
6 * Copyright 1992-1994, David Gottner |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
7 * |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
8 * All Rights Reserved |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
9 * |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
10 * Permission to use, copy, modify, and distribute this software and its |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
11 * documentation for any purpose and without fee is hereby granted, |
|
1598
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
12 * provided that the above copyright notice, this permission notice and |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
13 * the following disclaimer notice appear unmodified in all copies. |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
14 * |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
15 * I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL I |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
17 * BE LIABLE FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
18 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
19 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
20 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
21 * |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
22 * Nevertheless, I would like to know about bugs in this library or |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
23 * suggestions for improvment. Send bug reports and feedback to |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
24 * davegottner@delphi.com. |
|
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
25 *---------------------------------------------------------------------------*/ |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
27 /* Modified to support --help and --version, as well as /? on Windows |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
28 * by Georg Brandl. */ |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
29 |
|
46318
22a74eaf6b22
Change command line processing API to use wchar_t.
Martin v. Löwis <martin@v.loewis.de>
parents:
39442
diff
changeset
|
30 #include <Python.h> |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 #include <stdio.h> |
|
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 #include <string.h> |
|
46318
22a74eaf6b22
Change command line processing API to use wchar_t.
Martin v. Löwis <martin@v.loewis.de>
parents:
39442
diff
changeset
|
33 #include <wchar.h> |
|
22a74eaf6b22
Change command line processing API to use wchar_t.
Martin v. Löwis <martin@v.loewis.de>
parents:
39442
diff
changeset
|
34 #include <pygetopt.h> |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
15374
diff
changeset
|
36 #ifdef __cplusplus |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
15374
diff
changeset
|
37 extern "C" { |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
15374
diff
changeset
|
38 #endif |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
15374
diff
changeset
|
39 |
|
15374
a826a46bae54
Move our own getopt() implementation to _PyOS_GetOpt(), and use it
Thomas Wouters <thomas@python.org>
parents:
13658
diff
changeset
|
40 int _PyOS_opterr = 1; /* generate error messages */ |
|
a826a46bae54
Move our own getopt() implementation to _PyOS_GetOpt(), and use it
Thomas Wouters <thomas@python.org>
parents:
13658
diff
changeset
|
41 int _PyOS_optind = 1; /* index into argv array */ |
|
46318
22a74eaf6b22
Change command line processing API to use wchar_t.
Martin v. Löwis <martin@v.loewis.de>
parents:
39442
diff
changeset
|
42 wchar_t *_PyOS_optarg = NULL; /* optional argument */ |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
43 |
|
75142
0e8bd4785ea0
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
Antoine Pitrou <solipsis@pitrou.net>
parents:
65575
diff
changeset
|
44 static wchar_t *opt_ptr = L""; |
|
0e8bd4785ea0
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
Antoine Pitrou <solipsis@pitrou.net>
parents:
65575
diff
changeset
|
45 |
|
0e8bd4785ea0
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
Antoine Pitrou <solipsis@pitrou.net>
parents:
65575
diff
changeset
|
46 void _PyOS_ResetGetOpt(void) |
|
0e8bd4785ea0
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
Antoine Pitrou <solipsis@pitrou.net>
parents:
65575
diff
changeset
|
47 { |
|
80566
654a628f5f00
#16306: report only the first unknown option and add more tests. Patch by Serhiy Storchaka.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
80504
diff
changeset
|
48 _PyOS_opterr = 1; |
|
75142
0e8bd4785ea0
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
Antoine Pitrou <solipsis@pitrou.net>
parents:
65575
diff
changeset
|
49 _PyOS_optind = 1; |
|
0e8bd4785ea0
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
Antoine Pitrou <solipsis@pitrou.net>
parents:
65575
diff
changeset
|
50 _PyOS_optarg = NULL; |
|
0e8bd4785ea0
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
Antoine Pitrou <solipsis@pitrou.net>
parents:
65575
diff
changeset
|
51 opt_ptr = L""; |
|
0e8bd4785ea0
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
Antoine Pitrou <solipsis@pitrou.net>
parents:
65575
diff
changeset
|
52 } |
|
0e8bd4785ea0
Fix test failure in test_cmd_line by initializing the hash secret at the earliest point.
Antoine Pitrou <solipsis@pitrou.net>
parents:
65575
diff
changeset
|
53 |
|
46318
22a74eaf6b22
Change command line processing API to use wchar_t.
Martin v. Löwis <martin@v.loewis.de>
parents:
39442
diff
changeset
|
54 int _PyOS_GetOpt(int argc, wchar_t **argv, wchar_t *optstring) |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
55 { |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
56 wchar_t *ptr; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
57 wchar_t option; |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
58 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
59 if (*opt_ptr == '\0') { |
|
1598
ecbadb818847
New version handles -o<string> same as -o <string>
Guido van Rossum <guido@python.org>
parents:
1585
diff
changeset
|
60 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
61 if (_PyOS_optind >= argc) |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
62 return -1; |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
63 #ifdef MS_WINDOWS |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
64 else if (wcscmp(argv[_PyOS_optind], L"/?") == 0) { |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
65 ++_PyOS_optind; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
66 return 'h'; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
67 } |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
68 #endif |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
69 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
70 else if (argv[_PyOS_optind][0] != L'-' || |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
71 argv[_PyOS_optind][1] == L'\0' /* lone dash */ ) |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
72 return -1; |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
73 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
74 else if (wcscmp(argv[_PyOS_optind], L"--") == 0) { |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
75 ++_PyOS_optind; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
76 return -1; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
77 } |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
78 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
79 else if (wcscmp(argv[_PyOS_optind], L"--help") == 0) { |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
80 ++_PyOS_optind; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
81 return 'h'; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
82 } |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
83 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
84 else if (wcscmp(argv[_PyOS_optind], L"--version") == 0) { |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
85 ++_PyOS_optind; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
86 return 'V'; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
87 } |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
88 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
89 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
90 opt_ptr = &argv[_PyOS_optind++][1]; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
91 } |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
92 |
|
80504
0153c077a0fd
#16306: Fix multiple error messages when unknown command line parameters where passed to the interpreter. Patch by Hieu Nguyen.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
75142
diff
changeset
|
93 if ((option = *opt_ptr++) == L'\0') |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
94 return -1; |
|
46430
47d9bbe10897
Merged revisions 62260-62261,62266,62271,62277-62279,62289-62290,62293-62298,62302-62306,62308,62311,62313-62315,62319-62321 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
46318
diff
changeset
|
95 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
96 if (option == 'J') { |
|
80504
0153c077a0fd
#16306: Fix multiple error messages when unknown command line parameters where passed to the interpreter. Patch by Hieu Nguyen.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
75142
diff
changeset
|
97 if (_PyOS_opterr) |
|
0153c077a0fd
#16306: Fix multiple error messages when unknown command line parameters where passed to the interpreter. Patch by Hieu Nguyen.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
75142
diff
changeset
|
98 fprintf(stderr, "-J is reserved for Jython\n"); |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
99 return '_'; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
100 } |
|
46430
47d9bbe10897
Merged revisions 62260-62261,62266,62271,62277-62279,62289-62290,62293-62298,62302-62306,62308,62311,62313-62315,62319-62321 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
46318
diff
changeset
|
101 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
102 if ((ptr = wcschr(optstring, option)) == NULL) { |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
103 if (_PyOS_opterr) |
|
80504
0153c077a0fd
#16306: Fix multiple error messages when unknown command line parameters where passed to the interpreter. Patch by Hieu Nguyen.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
75142
diff
changeset
|
104 fprintf(stderr, "Unknown option: -%c\n", (char)option); |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
105 return '_'; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
106 } |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
107 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
108 if (*(ptr + 1) == L':') { |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
109 if (*opt_ptr != L'\0') { |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
110 _PyOS_optarg = opt_ptr; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
111 opt_ptr = L""; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
112 } |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
113 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
114 else { |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
115 if (_PyOS_optind >= argc) { |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
116 if (_PyOS_opterr) |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
117 fprintf(stderr, |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
118 "Argument expected for the -%c option\n", (char)option); |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
119 return '_'; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
120 } |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
121 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
122 _PyOS_optarg = argv[_PyOS_optind++]; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
123 } |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
124 } |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
125 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46453
diff
changeset
|
126 return option; |
|
1585
7c75f60468f8
A getopt.c for your amusement
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
127 } |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
15374
diff
changeset
|
128 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
15374
diff
changeset
|
129 #ifdef __cplusplus |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
15374
diff
changeset
|
130 } |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
15374
diff
changeset
|
131 #endif |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
15374
diff
changeset
|
132 |
