Mercurial > cpython-lru_cache-weakref
annotate Python/modsupport.c @ 42466:3fc3cedc49ca
Merged revisions 56753-56781 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r56760 | neal.norwitz | 2007-08-05 18:55:39 -0700 (Sun, 05 Aug 2007) | 178 lines
Merged revisions 56477-56759 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r56485 | facundo.batista | 2007-07-21 17:13:00 -0700 (Sat, 21 Jul 2007) | 5 lines
Selectively enable tests for asyncore.readwrite based on the presence
of poll support in the select module (since this is the only case in
which readwrite can be called). [GSoC - Alan McIntyre]
........
r56488 | nick.coghlan | 2007-07-22 03:18:07 -0700 (Sun, 22 Jul 2007) | 1 line
Add explicit relative import tests for runpy.run_module
........
r56509 | nick.coghlan | 2007-07-23 06:41:45 -0700 (Mon, 23 Jul 2007) | 5 lines
Correctly cleanup sys.modules after executing runpy relative import
tests
Restore Python 2.4 ImportError when attempting to execute a package
(as imports cannot be guaranteed to work properly if you try it)
........
r56519 | nick.coghlan | 2007-07-24 06:07:38 -0700 (Tue, 24 Jul 2007) | 1 line
Tweak runpy test to do a better job of confirming that sys has been manipulated correctly
........
r56520 | nick.coghlan | 2007-07-24 06:58:28 -0700 (Tue, 24 Jul 2007) | 1 line
Fix an incompatibility between the -i and -m command line switches as reported on python-dev by PJE - runpy.run_module now leaves any changes it makes to the sys module intact after the function terminates
........
r56523 | nick.coghlan | 2007-07-24 07:39:23 -0700 (Tue, 24 Jul 2007) | 1 line
Try to get rid of spurious failure in test_resource on the Debian buildbots by changing the file size limit before attempting to close the file
........
r56533 | facundo.batista | 2007-07-24 14:20:42 -0700 (Tue, 24 Jul 2007) | 7 lines
New tests for basic behavior of smtplib.SMTP and
smtpd.DebuggingServer. Change to use global host & port number
variables. Modified the 'server' to take a string to send back in
order to vary test server responses. Added a test for the reaction of
smtplib.SMTP to a non-200 HELO response. [GSoC - Alan McIntyre]
........
r56538 | nick.coghlan | 2007-07-25 05:57:48 -0700 (Wed, 25 Jul 2007) | 1 line
More buildbot cleanup - let the OS assign the port for test_urllib2_localnet
........
r56539 | nick.coghlan | 2007-07-25 06:18:58 -0700 (Wed, 25 Jul 2007) | 1 line
Add a temporary diagnostic message before a strange failure on the alpha Debian buildbot
........
r56543 | martin.v.loewis | 2007-07-25 09:24:23 -0700 (Wed, 25 Jul 2007) | 2 lines
Change location of the package index to pypi.python.org/pypi
........
r56551 | georg.brandl | 2007-07-26 02:36:25 -0700 (Thu, 26 Jul 2007) | 2 lines
tabs, newlines and crs are valid XML characters.
........
r56553 | nick.coghlan | 2007-07-26 07:03:00 -0700 (Thu, 26 Jul 2007) | 1 line
Add explicit test for a misbehaving math.floor
........
r56561 | mark.hammond | 2007-07-26 21:52:32 -0700 (Thu, 26 Jul 2007) | 3 lines
In consultation with Kristjan Jonsson, only define WINVER and _WINNT_WIN32
if (a) we are building Python itself and (b) no one previously defined them
........
r56562 | mark.hammond | 2007-07-26 22:08:54 -0700 (Thu, 26 Jul 2007) | 2 lines
Correctly detect AMD64 architecture on VC2003
........
r56566 | nick.coghlan | 2007-07-27 03:36:30 -0700 (Fri, 27 Jul 2007) | 1 line
Make test_math error messages more meaningful for small discrepancies in results
........
r56588 | martin.v.loewis | 2007-07-27 11:28:22 -0700 (Fri, 27 Jul 2007) | 2 lines
Bug #978833: Close https sockets by releasing the _ssl object.
........
r56601 | martin.v.loewis | 2007-07-28 00:03:05 -0700 (Sat, 28 Jul 2007) | 3 lines
Bug #1704793: Return UTF-16 pair if unicodedata.lookup cannot
represent the result in a single character.
........
r56604 | facundo.batista | 2007-07-28 07:21:22 -0700 (Sat, 28 Jul 2007) | 9 lines
Moved all of the capture_server socket setup code into the try block
so that the event gets set if a failure occurs during server setup
(otherwise the test will block forever). Changed to let the OS assign
the server port number, and client side of test waits for port number
assignment before proceeding. The test data in DispatcherWithSendTests
is also sent in multiple send() calls instead of one to make sure this
works properly. [GSoC - Alan McIntyre]
........
r56611 | georg.brandl | 2007-07-29 01:26:10 -0700 (Sun, 29 Jul 2007) | 2 lines
Clarify PEP 343 description.
........
r56614 | georg.brandl | 2007-07-29 02:11:15 -0700 (Sun, 29 Jul 2007) | 2 lines
try-except-finally is new in 2.5.
........
r56617 | facundo.batista | 2007-07-29 07:23:08 -0700 (Sun, 29 Jul 2007) | 9 lines
Added tests for asynchat classes simple_producer & fifo, and the
find_prefix_at_end function. Check behavior of a string given as a
producer. Added tests for behavior of asynchat.async_chat when given
int, long, and None terminator arguments. Added usepoll attribute to
TestAsynchat to allow running the asynchat tests with poll support
chosen whether it's available or not (improves coverage of asyncore
code). [GSoC - Alan McIntyre]
........
r56620 | georg.brandl | 2007-07-29 10:38:35 -0700 (Sun, 29 Jul 2007) | 2 lines
Bug #1763149: use proper slice syntax in docstring.
(backport)
........
r56624 | mark.hammond | 2007-07-29 17:45:29 -0700 (Sun, 29 Jul 2007) | 4 lines
Correct use of Py_BUILD_CORE - now make sure it is defined before it is
referenced, and also fix definition of _WIN32_WINNT.
Resolves patch 1761803.
........
r56632 | facundo.batista | 2007-07-30 20:03:34 -0700 (Mon, 30 Jul 2007) | 8 lines
When running asynchat tests on OS X (darwin), the test client now
overrides asyncore.dispatcher.handle_expt to do nothing, since
select.poll gives a POLLHUP error at the completion of these tests.
Added timeout & count arguments to several asyncore.loop calls to
avoid the possibility of a test hanging up a build. [GSoC - Alan
McIntyre]
........
r56633 | nick.coghlan | 2007-07-31 06:38:01 -0700 (Tue, 31 Jul 2007) | 1 line
Eliminate RLock race condition reported in SF bug #1764059
........
r56636 | martin.v.loewis | 2007-07-31 12:57:56 -0700 (Tue, 31 Jul 2007) | 2 lines
Define _BSD_SOURCE, to get access to POSIX extensions on OpenBSD 4.1+.
........
r56653 | facundo.batista | 2007-08-01 16:18:36 -0700 (Wed, 01 Aug 2007) | 9 lines
Allow the OS to select a free port for each test server. For
DebuggingServerTests, construct SMTP objects with a localhost argument
to avoid abysmally long FQDN lookups (not relevant to items under
test) on some machines that would cause the test to fail. Moved server
setup code in the server function inside the try block to avoid the
possibility of setup failure hanging the test. Minor edits to conform
to PEP 8. [GSoC - Alan McIntyre]
........
r56681 | matthias.klose | 2007-08-02 14:33:13 -0700 (Thu, 02 Aug 2007) | 2 lines
- Allow Emacs 22 for building the documentation in info format.
........
r56689 | neal.norwitz | 2007-08-02 23:46:29 -0700 (Thu, 02 Aug 2007) | 1 line
Py_ssize_t is defined regardless of HAVE_LONG_LONG. Will backport
........
r56727 | hyeshik.chang | 2007-08-03 21:10:18 -0700 (Fri, 03 Aug 2007) | 3 lines
Fix gb18030 codec's bug that doesn't map two-byte characters on
GB18030 extension in encoding. (bug reported by Bjorn Stabell)
........
r56751 | neal.norwitz | 2007-08-04 20:23:31 -0700 (Sat, 04 Aug 2007) | 7 lines
Handle errors when generating a warning.
The value is always written to the returned pointer if getting it was
successful, even if a warning causes an error. (This probably doesn't matter
as the caller will probably discard the value.)
Will backport.
........
................
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 06 Aug 2007 23:33:07 +0000 |
| parents | d0719406b2c6 |
| children | 0fcc18aba385 |
| rev | line source |
|---|---|
| 145 | 1 |
| 6 | 2 /* Module support implementation */ |
| 3 | |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
4 #include "Python.h" |
| 6 | 5 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
6 #define FLAG_SIZE_T 1 |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
7 typedef double va_double; |
|
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
8 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
9 static PyObject *va_build_value(const char *, va_list, int); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
10 |
|
6602
4514a5ea3ec4
Fix importing of shared libraries from inside packages.
Guido van Rossum <guido@python.org>
parents:
5925
diff
changeset
|
11 /* Package context -- the full module name for package imports */ |
|
4514a5ea3ec4
Fix importing of shared libraries from inside packages.
Guido van Rossum <guido@python.org>
parents:
5925
diff
changeset
|
12 char *_Py_PackageContext = NULL; |
|
4514a5ea3ec4
Fix importing of shared libraries from inside packages.
Guido van Rossum <guido@python.org>
parents:
5925
diff
changeset
|
13 |
|
5925
93304b2e14cb
Removed fatal errors from Py_Initmodule4() (and thus from
Guido van Rossum <guido@python.org>
parents:
5373
diff
changeset
|
14 /* Py_InitModule4() parameters: |
| 2095 | 15 - name is the module name |
| 16 - methods is the list of top-level functions | |
| 17 - doc is the documentation string | |
| 18 - passthrough is passed as self to functions defined in the module | |
| 19 - api_version is the value of PYTHON_API_VERSION at the time the | |
| 20 module was compiled | |
|
5925
93304b2e14cb
Removed fatal errors from Py_Initmodule4() (and thus from
Guido van Rossum <guido@python.org>
parents:
5373
diff
changeset
|
21 |
|
93304b2e14cb
Removed fatal errors from Py_Initmodule4() (and thus from
Guido van Rossum <guido@python.org>
parents:
5373
diff
changeset
|
22 Return value is a borrowed reference to the module object; or NULL |
|
93304b2e14cb
Removed fatal errors from Py_Initmodule4() (and thus from
Guido van Rossum <guido@python.org>
parents:
5373
diff
changeset
|
23 if an error occurred (in Python 1.4 and before, errors were fatal). |
|
93304b2e14cb
Removed fatal errors from Py_Initmodule4() (and thus from
Guido van Rossum <guido@python.org>
parents:
5373
diff
changeset
|
24 Errors may still leak memory. |
|
2090
f78b387b54e0
New newmethodobject() interface takes struct methodlist pointer
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
25 */ |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
26 |
| 2095 | 27 static char api_version_warning[] = |
|
18908
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17032
diff
changeset
|
28 "Python C API version mismatch for module %.100s:\ |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17032
diff
changeset
|
29 This Python has API version %d, module %.100s has version %d."; |
| 2095 | 30 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
31 PyObject * |
|
35999
9541369b0dca
Add const to several API functions that take char *.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
35935
diff
changeset
|
32 Py_InitModule4(const char *name, PyMethodDef *methods, const char *doc, |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13447
diff
changeset
|
33 PyObject *passthrough, int module_api_version) |
| 6 | 34 { |
|
27559
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
27533
diff
changeset
|
35 PyObject *m, *d, *v, *n; |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
36 PyMethodDef *ml; |
|
13859
94f6ec87930a
Add a test that Py_IsInitialized() in Py_InitModule4(). See
Guido van Rossum <guido@python.org>
parents:
13658
diff
changeset
|
37 if (!Py_IsInitialized()) |
|
94f6ec87930a
Add a test that Py_IsInitialized() in Py_InitModule4(). See
Guido van Rossum <guido@python.org>
parents:
13658
diff
changeset
|
38 Py_FatalError("Interpreter not initialized (version mismatch?)"); |
|
18908
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17032
diff
changeset
|
39 if (module_api_version != PYTHON_API_VERSION) { |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17032
diff
changeset
|
40 char message[512]; |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17032
diff
changeset
|
41 PyOS_snprintf(message, sizeof(message), |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17032
diff
changeset
|
42 api_version_warning, name, |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17032
diff
changeset
|
43 PYTHON_API_VERSION, name, |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17032
diff
changeset
|
44 module_api_version); |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17032
diff
changeset
|
45 if (PyErr_Warn(PyExc_RuntimeWarning, message)) |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17032
diff
changeset
|
46 return NULL; |
|
79c676f9b34a
This patch turns the Python API mismatch notice into a standard
Marc-André Lemburg <mal@egenix.com>
parents:
17032
diff
changeset
|
47 } |
|
27559
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
27533
diff
changeset
|
48 /* Make sure name is fully qualified. |
|
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
27533
diff
changeset
|
49 |
|
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
27533
diff
changeset
|
50 This is a bit of a hack: when the shared library is loaded, |
|
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
27533
diff
changeset
|
51 the module name is "package.module", but the module calls |
|
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
27533
diff
changeset
|
52 Py_InitModule*() with just "module" for the name. The shared |
|
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
27533
diff
changeset
|
53 library loader squirrels away the true name of the module in |
|
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
27533
diff
changeset
|
54 _Py_PackageContext, and Py_InitModule*() will substitute this |
|
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
27533
diff
changeset
|
55 (if the name actually matches). |
|
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
27533
diff
changeset
|
56 */ |
|
6602
4514a5ea3ec4
Fix importing of shared libraries from inside packages.
Guido van Rossum <guido@python.org>
parents:
5925
diff
changeset
|
57 if (_Py_PackageContext != NULL) { |
|
4514a5ea3ec4
Fix importing of shared libraries from inside packages.
Guido van Rossum <guido@python.org>
parents:
5925
diff
changeset
|
58 char *p = strrchr(_Py_PackageContext, '.'); |
|
4514a5ea3ec4
Fix importing of shared libraries from inside packages.
Guido van Rossum <guido@python.org>
parents:
5925
diff
changeset
|
59 if (p != NULL && strcmp(name, p+1) == 0) { |
|
4514a5ea3ec4
Fix importing of shared libraries from inside packages.
Guido van Rossum <guido@python.org>
parents:
5925
diff
changeset
|
60 name = _Py_PackageContext; |
|
4514a5ea3ec4
Fix importing of shared libraries from inside packages.
Guido van Rossum <guido@python.org>
parents:
5925
diff
changeset
|
61 _Py_PackageContext = NULL; |
|
4514a5ea3ec4
Fix importing of shared libraries from inside packages.
Guido van Rossum <guido@python.org>
parents:
5925
diff
changeset
|
62 } |
|
4514a5ea3ec4
Fix importing of shared libraries from inside packages.
Guido van Rossum <guido@python.org>
parents:
5925
diff
changeset
|
63 } |
|
5925
93304b2e14cb
Removed fatal errors from Py_Initmodule4() (and thus from
Guido van Rossum <guido@python.org>
parents:
5373
diff
changeset
|
64 if ((m = PyImport_AddModule(name)) == NULL) |
|
93304b2e14cb
Removed fatal errors from Py_Initmodule4() (and thus from
Guido van Rossum <guido@python.org>
parents:
5373
diff
changeset
|
65 return NULL; |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
66 d = PyModule_GetDict(m); |
|
24834
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
67 if (methods != NULL) { |
|
42013
cd125fe83051
Make identifiers str (not str8) objects throughout.
Martin v. Löwis <martin@v.loewis.de>
parents:
41766
diff
changeset
|
68 n = PyUnicode_FromString(name); |
|
27559
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
27533
diff
changeset
|
69 if (n == NULL) |
|
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
27533
diff
changeset
|
70 return NULL; |
|
24834
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
71 for (ml = methods; ml->ml_name != NULL; ml++) { |
|
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
72 if ((ml->ml_flags & METH_CLASS) || |
|
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
73 (ml->ml_flags & METH_STATIC)) { |
|
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
74 PyErr_SetString(PyExc_ValueError, |
|
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
75 "module functions cannot set" |
|
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
76 " METH_CLASS or METH_STATIC"); |
|
36774
35612a131ac6
Fix more memory leaks. Will backport to 2.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
36521
diff
changeset
|
77 Py_DECREF(n); |
|
24834
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
78 return NULL; |
|
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
79 } |
|
27559
faabd9867fb8
Provide __module__ attributes for functions defined in C and Python.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
27533
diff
changeset
|
80 v = PyCFunction_NewEx(ml, passthrough, n); |
|
36774
35612a131ac6
Fix more memory leaks. Will backport to 2.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
36521
diff
changeset
|
81 if (v == NULL) { |
|
35612a131ac6
Fix more memory leaks. Will backport to 2.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
36521
diff
changeset
|
82 Py_DECREF(n); |
|
24834
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
83 return NULL; |
|
36774
35612a131ac6
Fix more memory leaks. Will backport to 2.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
36521
diff
changeset
|
84 } |
|
24834
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
85 if (PyDict_SetItemString(d, ml->ml_name, v) != 0) { |
|
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
86 Py_DECREF(v); |
|
36774
35612a131ac6
Fix more memory leaks. Will backport to 2.4.
Martin v. Löwis <martin@v.loewis.de>
parents:
36521
diff
changeset
|
87 Py_DECREF(n); |
|
24834
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
88 return NULL; |
|
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
89 } |
|
64f4dd770c67
Py_InitModule4(): Accept NULL for the 'methods' argument. This makes
Fred Drake <fdrake@acm.org>
parents:
24400
diff
changeset
|
90 Py_DECREF(v); |
|
22613
ddc9543c76a0
Introduce two new flag bits that can be set in a PyMethodDef method
Fred Drake <fdrake@acm.org>
parents:
19343
diff
changeset
|
91 } |
|
35895
fe4c627b2096
Fix a few more memory leaks
Neal Norwitz <nnorwitz@gmail.com>
parents:
32656
diff
changeset
|
92 Py_DECREF(n); |
| 6 | 93 } |
|
2090
f78b387b54e0
New newmethodobject() interface takes struct methodlist pointer
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
94 if (doc != NULL) { |
|
42060
ba5d1a3977e9
Make module docstrings unicode objects.
Walter Dörwald <walter@livinglogic.de>
parents:
42013
diff
changeset
|
95 v = PyUnicode_FromString(doc); |
|
18991
360cece76123
Plug a memory leak in Py_InitModule4(): when PyDict_SetItemString() failed,
Fred Drake <fdrake@acm.org>
parents:
18908
diff
changeset
|
96 if (v == NULL || PyDict_SetItemString(d, "__doc__", v) != 0) { |
|
26664
fe2d422385b1
Fixed potential crash: v can be NULL here, so use Py_XDECREF rather than Py_DECREF
Just van Rossum <just@letterror.com>
parents:
24834
diff
changeset
|
97 Py_XDECREF(v); |
|
5925
93304b2e14cb
Removed fatal errors from Py_Initmodule4() (and thus from
Guido van Rossum <guido@python.org>
parents:
5373
diff
changeset
|
98 return NULL; |
|
18991
360cece76123
Plug a memory leak in Py_InitModule4(): when PyDict_SetItemString() failed,
Fred Drake <fdrake@acm.org>
parents:
18908
diff
changeset
|
99 } |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
100 Py_DECREF(v); |
|
2090
f78b387b54e0
New newmethodobject() interface takes struct methodlist pointer
Guido van Rossum <guido@python.org>
parents:
2062
diff
changeset
|
101 } |
| 86 | 102 return m; |
| 6 | 103 } |
| 104 | |
| 105 | |
|
1211
406860dfaac7
* stdwinmodule.c: various new commands: setwin{pos,size},
Guido van Rossum <guido@python.org>
parents:
1198
diff
changeset
|
106 /* Helper for mkvalue() to scan the length of a format */ |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
107 |
|
27533
842d6a24497a
Style consistency, so "grep ^function ..." works as expected.
Fred Drake <fdrake@acm.org>
parents:
26664
diff
changeset
|
108 static int |
|
35999
9541369b0dca
Add const to several API functions that take char *.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
35935
diff
changeset
|
109 countformat(const char *format, int endchar) |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
110 { |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
111 int count = 0; |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
112 int level = 0; |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
113 while (level > 0 || *format != endchar) { |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
114 switch (*format) { |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
115 case '\0': |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
116 /* Premature end */ |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
117 PyErr_SetString(PyExc_SystemError, |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
118 "unmatched paren in format"); |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
119 return -1; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
120 case '(': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
121 case '[': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
122 case '{': |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
123 if (level == 0) |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
124 count++; |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
125 level++; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
126 break; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
127 case ')': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
128 case ']': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
129 case '}': |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
130 level--; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
131 break; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
132 case '#': |
|
2202
9894e55468ec
support "O&" taking an object constructor a void*
Guido van Rossum <guido@python.org>
parents:
2154
diff
changeset
|
133 case '&': |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
134 case ',': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
135 case ':': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
136 case ' ': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
137 case '\t': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
138 break; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
139 default: |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
140 if (level == 0) |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
141 count++; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
142 } |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
143 format++; |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
144 } |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
145 return count; |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
146 } |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
147 |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
148 |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
149 /* Generic function to create a value -- the inverse of getargs() */ |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
150 /* After an original idea and first implementation by Steven Miale */ |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
151 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
152 static PyObject *do_mktuple(const char**, va_list *, int, int, int); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
153 static PyObject *do_mklist(const char**, va_list *, int, int, int); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
154 static PyObject *do_mkdict(const char**, va_list *, int, int, int); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
155 static PyObject *do_mkvalue(const char**, va_list *, int); |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
156 |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
157 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
158 static PyObject * |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
159 do_mkdict(const char **p_format, va_list *p_va, int endchar, int n, int flags) |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
160 { |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
161 PyObject *d; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
162 int i; |
|
32656
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
163 int itemfailed = 0; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
164 if (n < 0) |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
165 return NULL; |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
166 if ((d = PyDict_New()) == NULL) |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
167 return NULL; |
|
32656
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
168 /* Note that we can't bail immediately on error as this will leak |
|
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
169 refcounts on any 'N' arguments. */ |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
170 for (i = 0; i < n; i+= 2) { |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
171 PyObject *k, *v; |
|
6613
2e874a5a912f
Plug memory leak in Py_BuildValue when using {...} to construct dictionaries.
Guido van Rossum <guido@python.org>
parents:
6602
diff
changeset
|
172 int err; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
173 k = do_mkvalue(p_format, p_va, flags); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
174 if (k == NULL) { |
|
32656
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
175 itemfailed = 1; |
|
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
176 Py_INCREF(Py_None); |
|
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
177 k = Py_None; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
178 } |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
179 v = do_mkvalue(p_format, p_va, flags); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
180 if (v == NULL) { |
|
32656
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
181 itemfailed = 1; |
|
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
182 Py_INCREF(Py_None); |
|
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
183 v = Py_None; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
184 } |
|
6613
2e874a5a912f
Plug memory leak in Py_BuildValue when using {...} to construct dictionaries.
Guido van Rossum <guido@python.org>
parents:
6602
diff
changeset
|
185 err = PyDict_SetItem(d, k, v); |
|
2e874a5a912f
Plug memory leak in Py_BuildValue when using {...} to construct dictionaries.
Guido van Rossum <guido@python.org>
parents:
6602
diff
changeset
|
186 Py_DECREF(k); |
|
2e874a5a912f
Plug memory leak in Py_BuildValue when using {...} to construct dictionaries.
Guido van Rossum <guido@python.org>
parents:
6602
diff
changeset
|
187 Py_DECREF(v); |
|
32656
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
188 if (err < 0 || itemfailed) { |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
189 Py_DECREF(d); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
190 return NULL; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
191 } |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
192 } |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
193 if (d != NULL && **p_format != endchar) { |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
194 Py_DECREF(d); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
195 d = NULL; |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
196 PyErr_SetString(PyExc_SystemError, |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
197 "Unmatched paren in format"); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
198 } |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
199 else if (endchar) |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
200 ++*p_format; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
201 return d; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
202 } |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
203 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
204 static PyObject * |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
205 do_mklist(const char **p_format, va_list *p_va, int endchar, int n, int flags) |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
206 { |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
207 PyObject *v; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
208 int i; |
|
32656
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
209 int itemfailed = 0; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
210 if (n < 0) |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
211 return NULL; |
|
36858
7fac5d79d043
Try to cleanup the error handling a bit so there aren't false positives
Neal Norwitz <nnorwitz@gmail.com>
parents:
36774
diff
changeset
|
212 v = PyList_New(n); |
|
7fac5d79d043
Try to cleanup the error handling a bit so there aren't false positives
Neal Norwitz <nnorwitz@gmail.com>
parents:
36774
diff
changeset
|
213 if (v == NULL) |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
214 return NULL; |
|
32656
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
215 /* Note that we can't bail immediately on error as this will leak |
|
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
216 refcounts on any 'N' arguments. */ |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
217 for (i = 0; i < n; i++) { |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
218 PyObject *w = do_mkvalue(p_format, p_va, flags); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
219 if (w == NULL) { |
|
32656
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
220 itemfailed = 1; |
|
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
221 Py_INCREF(Py_None); |
|
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
222 w = Py_None; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
223 } |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
224 PyList_SET_ITEM(v, i, w); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
225 } |
|
36858
7fac5d79d043
Try to cleanup the error handling a bit so there aren't false positives
Neal Norwitz <nnorwitz@gmail.com>
parents:
36774
diff
changeset
|
226 |
|
7fac5d79d043
Try to cleanup the error handling a bit so there aren't false positives
Neal Norwitz <nnorwitz@gmail.com>
parents:
36774
diff
changeset
|
227 if (itemfailed) { |
|
7fac5d79d043
Try to cleanup the error handling a bit so there aren't false positives
Neal Norwitz <nnorwitz@gmail.com>
parents:
36774
diff
changeset
|
228 /* do_mkvalue() should have already set an error */ |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
229 Py_DECREF(v); |
|
36858
7fac5d79d043
Try to cleanup the error handling a bit so there aren't false positives
Neal Norwitz <nnorwitz@gmail.com>
parents:
36774
diff
changeset
|
230 return NULL; |
|
7fac5d79d043
Try to cleanup the error handling a bit so there aren't false positives
Neal Norwitz <nnorwitz@gmail.com>
parents:
36774
diff
changeset
|
231 } |
|
7fac5d79d043
Try to cleanup the error handling a bit so there aren't false positives
Neal Norwitz <nnorwitz@gmail.com>
parents:
36774
diff
changeset
|
232 if (**p_format != endchar) { |
|
7fac5d79d043
Try to cleanup the error handling a bit so there aren't false positives
Neal Norwitz <nnorwitz@gmail.com>
parents:
36774
diff
changeset
|
233 Py_DECREF(v); |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
234 PyErr_SetString(PyExc_SystemError, |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
235 "Unmatched paren in format"); |
|
36858
7fac5d79d043
Try to cleanup the error handling a bit so there aren't false positives
Neal Norwitz <nnorwitz@gmail.com>
parents:
36774
diff
changeset
|
236 return NULL; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
237 } |
|
36858
7fac5d79d043
Try to cleanup the error handling a bit so there aren't false positives
Neal Norwitz <nnorwitz@gmail.com>
parents:
36774
diff
changeset
|
238 if (endchar) |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
239 ++*p_format; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
240 return v; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
241 } |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
242 |
|
12520
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
243 static int |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
244 _ustrlen(Py_UNICODE *u) |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
245 { |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
246 int i = 0; |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
247 Py_UNICODE *v = u; |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
248 while (*v != 0) { i++; v++; } |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
249 return i; |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
250 } |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
251 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
252 static PyObject * |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
253 do_mktuple(const char **p_format, va_list *p_va, int endchar, int n, int flags) |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
254 { |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
255 PyObject *v; |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
256 int i; |
|
32656
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
257 int itemfailed = 0; |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
258 if (n < 0) |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
259 return NULL; |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
260 if ((v = PyTuple_New(n)) == NULL) |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
261 return NULL; |
|
32656
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
262 /* Note that we can't bail immediately on error as this will leak |
|
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
263 refcounts on any 'N' arguments. */ |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
264 for (i = 0; i < n; i++) { |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
265 PyObject *w = do_mkvalue(p_format, p_va, flags); |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
266 if (w == NULL) { |
|
32656
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
267 itemfailed = 1; |
|
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
268 Py_INCREF(Py_None); |
|
391937571065
This is Pete Shinners' patch from his bug report
Michael W. Hudson <mwh@python.net>
parents:
30968
diff
changeset
|
269 w = Py_None; |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
270 } |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
271 PyTuple_SET_ITEM(v, i, w); |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
272 } |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
273 if (itemfailed) { |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
274 /* do_mkvalue() should have already set an error */ |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
275 Py_DECREF(v); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
276 return NULL; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
277 } |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
278 if (**p_format != endchar) { |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
279 Py_DECREF(v); |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
280 PyErr_SetString(PyExc_SystemError, |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
281 "Unmatched paren in format"); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
282 return NULL; |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
283 } |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
284 if (endchar) |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
285 ++*p_format; |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
286 return v; |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
287 } |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
288 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
289 static PyObject * |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
290 do_mkvalue(const char **p_format, va_list *p_va, int flags) |
|
860
39134c99c923
Added parameter decls to do_mkvalue for non-template machines
Guido van Rossum <guido@python.org>
parents:
817
diff
changeset
|
291 { |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
292 for (;;) { |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
293 switch (*(*p_format)++) { |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
294 case '(': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
295 return do_mktuple(p_format, p_va, ')', |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
296 countformat(*p_format, ')'), flags); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
297 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
298 case '[': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
299 return do_mklist(p_format, p_va, ']', |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
300 countformat(*p_format, ']'), flags); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
301 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
302 case '{': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
303 return do_mkdict(p_format, p_va, '}', |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
304 countformat(*p_format, '}'), flags); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
305 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
306 case 'b': |
|
14588
dcbc084d046e
Cast UCHAR_MAX to int before doing the comparison for overflow of the
Jack Jansen <jack.jansen@cwi.nl>
parents:
14375
diff
changeset
|
307 case 'B': |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
308 case 'h': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
309 case 'i': |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
310 return PyInt_FromLong((long)va_arg(*p_va, int)); |
|
13378
113d833eea7e
Added support for H (unsigned short) specifier in PyArg_ParseTuple and
Jack Jansen <jack.jansen@cwi.nl>
parents:
13330
diff
changeset
|
311 |
|
113d833eea7e
Added support for H (unsigned short) specifier in PyArg_ParseTuple and
Jack Jansen <jack.jansen@cwi.nl>
parents:
13330
diff
changeset
|
312 case 'H': |
|
113d833eea7e
Added support for H (unsigned short) specifier in PyArg_ParseTuple and
Jack Jansen <jack.jansen@cwi.nl>
parents:
13330
diff
changeset
|
313 return PyInt_FromLong((long)va_arg(*p_va, unsigned int)); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
314 |
|
35935
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
315 case 'I': |
|
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
316 { |
|
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
317 unsigned int n; |
|
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
318 n = va_arg(*p_va, unsigned int); |
|
36115
03dbec0d9504
do_mkvalue(), 'I' and 'k' cases: squash legitimate
Tim Peters <tim.peters@gmail.com>
parents:
35999
diff
changeset
|
319 if (n > (unsigned long)PyInt_GetMax()) |
|
35935
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
320 return PyLong_FromUnsignedLong((unsigned long)n); |
|
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
321 else |
|
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
322 return PyInt_FromLong(n); |
|
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
323 } |
|
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
324 |
|
36501
7fdc639bc5b4
Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents:
36115
diff
changeset
|
325 case 'n': |
|
7fdc639bc5b4
Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents:
36115
diff
changeset
|
326 #if SIZEOF_SIZE_T!=SIZEOF_LONG |
|
36521
30aef3ce2b26
Use Py_ssize_t to count the
Martin v. Löwis <martin@v.loewis.de>
parents:
36501
diff
changeset
|
327 return PyInt_FromSsize_t(va_arg(*p_va, Py_ssize_t)); |
|
36501
7fdc639bc5b4
Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents:
36115
diff
changeset
|
328 #endif |
|
7fdc639bc5b4
Merge ssize_t branch.
Martin v. Löwis <martin@v.loewis.de>
parents:
36115
diff
changeset
|
329 /* Fall through from 'n' to 'l' if Py_ssize_t is long */ |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
330 case 'l': |
|
35935
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
331 return PyInt_FromLong(va_arg(*p_va, long)); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
332 |
|
28658
8836529e9e66
dded missing k and K format specifiers to Py_BuildValue and friends.
Jack Jansen <jack.jansen@cwi.nl>
parents:
28437
diff
changeset
|
333 case 'k': |
|
35935
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
334 { |
|
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
335 unsigned long n; |
|
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
336 n = va_arg(*p_va, unsigned long); |
|
36115
03dbec0d9504
do_mkvalue(), 'I' and 'k' cases: squash legitimate
Tim Peters <tim.peters@gmail.com>
parents:
35999
diff
changeset
|
337 if (n > (unsigned long)PyInt_GetMax()) |
|
35935
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
338 return PyLong_FromUnsignedLong(n); |
|
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
339 else |
|
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
340 return PyInt_FromLong(n); |
|
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
341 } |
|
28658
8836529e9e66
dded missing k and K format specifiers to Py_BuildValue and friends.
Jack Jansen <jack.jansen@cwi.nl>
parents:
28437
diff
changeset
|
342 |
|
9949
98e37347378b
Change rare occurrences of #if HAVE_LONG_LONG to #ifdef.
Guido van Rossum <guido@python.org>
parents:
9722
diff
changeset
|
343 #ifdef HAVE_LONG_LONG |
|
8822
bd47ee068b83
Changes for BeOS, QNX and long long, by Chris Herborth.
Guido van Rossum <guido@python.org>
parents:
8640
diff
changeset
|
344 case 'L': |
|
28437
871da703e4c0
Rename LONG_LONG to PY_LONG_LONG. Fixes #710285.
Martin v. Löwis <martin@v.loewis.de>
parents:
27559
diff
changeset
|
345 return PyLong_FromLongLong((PY_LONG_LONG)va_arg(*p_va, PY_LONG_LONG)); |
|
28658
8836529e9e66
dded missing k and K format specifiers to Py_BuildValue and friends.
Jack Jansen <jack.jansen@cwi.nl>
parents:
28437
diff
changeset
|
346 |
|
8836529e9e66
dded missing k and K format specifiers to Py_BuildValue and friends.
Jack Jansen <jack.jansen@cwi.nl>
parents:
28437
diff
changeset
|
347 case 'K': |
|
35935
7c8800b81c50
bug #1281408: make Py_BuildValue work with unsigned longs and long longs
Georg Brandl <georg@python.org>
parents:
35895
diff
changeset
|
348 return PyLong_FromUnsignedLongLong((PY_LONG_LONG)va_arg(*p_va, unsigned PY_LONG_LONG)); |
|
8822
bd47ee068b83
Changes for BeOS, QNX and long long, by Chris Herborth.
Guido van Rossum <guido@python.org>
parents:
8640
diff
changeset
|
349 #endif |
|
12520
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
350 case 'u': |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
351 { |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
352 PyObject *v; |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
353 Py_UNICODE *u = va_arg(*p_va, Py_UNICODE *); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
354 Py_ssize_t n; |
|
12520
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
355 if (**p_format == '#') { |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
356 ++*p_format; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
357 if (flags & FLAG_SIZE_T) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
358 n = va_arg(*p_va, Py_ssize_t); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
359 else |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
360 n = va_arg(*p_va, int); |
|
12520
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
361 } |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
362 else |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
363 n = -1; |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
364 if (u == NULL) { |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
365 v = Py_None; |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
366 Py_INCREF(v); |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
367 } |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
368 else { |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
369 if (n < 0) |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
370 n = _ustrlen(u); |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
371 v = PyUnicode_FromUnicode(u, n); |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
372 } |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
373 return v; |
|
b6b7bd20c845
Brian Hooper <brian_takashi@hotmail.com>:
Fred Drake <fdrake@acm.org>
parents:
9949
diff
changeset
|
374 } |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
375 case 'f': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
376 case 'd': |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
377 return PyFloat_FromDouble( |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
378 (double)va_arg(*p_va, va_double)); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
379 |
|
17032
d5811af8acf3
Py_BuildValue(): Add "D" conversion to create a Python complex value from
Fred Drake <fdrake@acm.org>
parents:
14869
diff
changeset
|
380 #ifndef WITHOUT_COMPLEX |
|
d5811af8acf3
Py_BuildValue(): Add "D" conversion to create a Python complex value from
Fred Drake <fdrake@acm.org>
parents:
14869
diff
changeset
|
381 case 'D': |
|
d5811af8acf3
Py_BuildValue(): Add "D" conversion to create a Python complex value from
Fred Drake <fdrake@acm.org>
parents:
14869
diff
changeset
|
382 return PyComplex_FromCComplex( |
|
d5811af8acf3
Py_BuildValue(): Add "D" conversion to create a Python complex value from
Fred Drake <fdrake@acm.org>
parents:
14869
diff
changeset
|
383 *((Py_complex *)va_arg(*p_va, Py_complex *))); |
|
d5811af8acf3
Py_BuildValue(): Add "D" conversion to create a Python complex value from
Fred Drake <fdrake@acm.org>
parents:
14869
diff
changeset
|
384 #endif /* WITHOUT_COMPLEX */ |
|
d5811af8acf3
Py_BuildValue(): Add "D" conversion to create a Python complex value from
Fred Drake <fdrake@acm.org>
parents:
14869
diff
changeset
|
385 |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
386 case 'c': |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
387 { |
|
42139
1f7b66a9ffb0
Revert r56044 (which changed the %c format specifier to accept a
Walter Dörwald <walter@livinglogic.de>
parents:
42119
diff
changeset
|
388 char p[1]; |
|
1f7b66a9ffb0
Revert r56044 (which changed the %c format specifier to accept a
Walter Dörwald <walter@livinglogic.de>
parents:
42119
diff
changeset
|
389 p[0] = (char)va_arg(*p_va, int); |
|
42305
d0719406b2c6
Change Py_BuildValue to generate Unicode objects for
Martin v. Löwis <martin@v.loewis.de>
parents:
42139
diff
changeset
|
390 return PyUnicode_FromStringAndSize(p, 1); |
|
42139
1f7b66a9ffb0
Revert r56044 (which changed the %c format specifier to accept a
Walter Dörwald <walter@livinglogic.de>
parents:
42119
diff
changeset
|
391 } |
|
1f7b66a9ffb0
Revert r56044 (which changed the %c format specifier to accept a
Walter Dörwald <walter@livinglogic.de>
parents:
42119
diff
changeset
|
392 case 'C': |
|
1f7b66a9ffb0
Revert r56044 (which changed the %c format specifier to accept a
Walter Dörwald <walter@livinglogic.de>
parents:
42119
diff
changeset
|
393 { |
|
42119
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
394 int i = va_arg(*p_va, int); |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
395 Py_UNICODE c; |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
396 if (i < 0 || i > PyUnicode_GetMax()) { |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
397 #ifdef Py_UNICODE_WIDE |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
398 PyErr_SetString(PyExc_OverflowError, |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
399 "%c arg not in range(0x110000) " |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
400 "(wide Python build)"); |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
401 #else |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
402 PyErr_SetString(PyExc_OverflowError, |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
403 "%c arg not in range(0x10000) " |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
404 "(narrow Python build)"); |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
405 #endif |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
406 return NULL; |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
407 } |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
408 c = i; |
|
4db0a0cc57ab
Change %c format specifier for PyArg_ParseTuple() so that it accepts
Walter Dörwald <walter@livinglogic.de>
parents:
42060
diff
changeset
|
409 return PyUnicode_FromUnicode(&c, 1); |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
410 } |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
411 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
412 case 's': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
413 case 'z': |
|
816
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
414 { |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
415 PyObject *v; |
|
816
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
416 char *str = va_arg(*p_va, char *); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
417 Py_ssize_t n; |
|
816
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
418 if (**p_format == '#') { |
|
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
419 ++*p_format; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
420 if (flags & FLAG_SIZE_T) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
421 n = va_arg(*p_va, Py_ssize_t); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
422 else |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
423 n = va_arg(*p_va, int); |
|
816
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
424 } |
|
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
425 else |
|
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
426 n = -1; |
|
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
427 if (str == NULL) { |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
428 v = Py_None; |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
429 Py_INCREF(v); |
|
816
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
430 } |
|
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
431 else { |
|
13096
8c8de5b736dc
Trent Mick's Win64 changes: size_t vs. int or long; also some overflow
Guido van Rossum <guido@python.org>
parents:
12520
diff
changeset
|
432 if (n < 0) { |
|
8c8de5b736dc
Trent Mick's Win64 changes: size_t vs. int or long; also some overflow
Guido van Rossum <guido@python.org>
parents:
12520
diff
changeset
|
433 size_t m = strlen(str); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
434 if (m > PY_SSIZE_T_MAX) { |
|
13096
8c8de5b736dc
Trent Mick's Win64 changes: size_t vs. int or long; also some overflow
Guido van Rossum <guido@python.org>
parents:
12520
diff
changeset
|
435 PyErr_SetString(PyExc_OverflowError, |
|
8c8de5b736dc
Trent Mick's Win64 changes: size_t vs. int or long; also some overflow
Guido van Rossum <guido@python.org>
parents:
12520
diff
changeset
|
436 "string too long for Python string"); |
|
8c8de5b736dc
Trent Mick's Win64 changes: size_t vs. int or long; also some overflow
Guido van Rossum <guido@python.org>
parents:
12520
diff
changeset
|
437 return NULL; |
|
8c8de5b736dc
Trent Mick's Win64 changes: size_t vs. int or long; also some overflow
Guido van Rossum <guido@python.org>
parents:
12520
diff
changeset
|
438 } |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
439 n = (Py_ssize_t)m; |
|
13096
8c8de5b736dc
Trent Mick's Win64 changes: size_t vs. int or long; also some overflow
Guido van Rossum <guido@python.org>
parents:
12520
diff
changeset
|
440 } |
|
42305
d0719406b2c6
Change Py_BuildValue to generate Unicode objects for
Martin v. Löwis <martin@v.loewis.de>
parents:
42139
diff
changeset
|
441 v = PyUnicode_FromStringAndSize(str, n); |
|
816
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
442 } |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
443 return v; |
|
816
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
444 } |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
445 |
|
41766
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
446 case 'U': |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
447 { |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
448 PyObject *v; |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
449 char *str = va_arg(*p_va, char *); |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
450 Py_ssize_t n; |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
451 if (**p_format == '#') { |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
452 ++*p_format; |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
453 if (flags & FLAG_SIZE_T) |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
454 n = va_arg(*p_va, Py_ssize_t); |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
455 else |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
456 n = va_arg(*p_va, int); |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
457 } |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
458 else |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
459 n = -1; |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
460 if (str == NULL) { |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
461 v = Py_None; |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
462 Py_INCREF(v); |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
463 } |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
464 else { |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
465 if (n < 0) { |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
466 size_t m = strlen(str); |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
467 if (m > PY_SSIZE_T_MAX) { |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
468 PyErr_SetString(PyExc_OverflowError, |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
469 "string too long for Python string"); |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
470 return NULL; |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
471 } |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
472 n = (Py_ssize_t)m; |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
473 } |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
474 v = PyUnicode_FromStringAndSize(str, n); |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
475 } |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
476 return v; |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
477 } |
|
d6aa7edf217a
Add 'U'/'U#' format characters to Py_BuildValue (and thus
Walter Dörwald <walter@livinglogic.de>
parents:
41611
diff
changeset
|
478 |
|
41611
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
479 case 'y': |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
480 { |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
481 PyObject *v; |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
482 char *str = va_arg(*p_va, char *); |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
483 Py_ssize_t n; |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
484 if (**p_format == '#') { |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
485 ++*p_format; |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
486 if (flags & FLAG_SIZE_T) |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
487 n = va_arg(*p_va, Py_ssize_t); |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
488 else |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
489 n = va_arg(*p_va, int); |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
490 } |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
491 else |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
492 n = -1; |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
493 if (str == NULL) { |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
494 v = Py_None; |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
495 Py_INCREF(v); |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
496 } |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
497 else { |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
498 if (n < 0) { |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
499 size_t m = strlen(str); |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
500 if (m > PY_SSIZE_T_MAX) { |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
501 PyErr_SetString(PyExc_OverflowError, |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
502 "string too long for Python bytes"); |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
503 return NULL; |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
504 } |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
505 n = (Py_ssize_t)m; |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
506 } |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
507 v = PyBytes_FromStringAndSize(str, n); |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
508 } |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
509 return v; |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
510 } |
|
c48fe4dc34a9
Change UnicodeDecodeError objects so that the 'object' attribute
Walter Dörwald <walter@livinglogic.de>
parents:
41587
diff
changeset
|
511 |
|
9720
24ca64134594
Add 'N' format character to Py_BuildValue -- like 'O' but doesn't INCREF.
Guido van Rossum <guido@python.org>
parents:
9044
diff
changeset
|
512 case 'N': |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
513 case 'S': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
514 case 'O': |
|
2202
9894e55468ec
support "O&" taking an object constructor a void*
Guido van Rossum <guido@python.org>
parents:
2154
diff
changeset
|
515 if (**p_format == '&') { |
|
13447
a89f7f268de4
Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.
Tim Peters <tim.peters@gmail.com>
parents:
13378
diff
changeset
|
516 typedef PyObject *(*converter)(void *); |
|
2202
9894e55468ec
support "O&" taking an object constructor a void*
Guido van Rossum <guido@python.org>
parents:
2154
diff
changeset
|
517 converter func = va_arg(*p_va, converter); |
|
9894e55468ec
support "O&" taking an object constructor a void*
Guido van Rossum <guido@python.org>
parents:
2154
diff
changeset
|
518 void *arg = va_arg(*p_va, void *); |
|
9894e55468ec
support "O&" taking an object constructor a void*
Guido van Rossum <guido@python.org>
parents:
2154
diff
changeset
|
519 ++*p_format; |
|
9894e55468ec
support "O&" taking an object constructor a void*
Guido van Rossum <guido@python.org>
parents:
2154
diff
changeset
|
520 return (*func)(arg); |
|
9894e55468ec
support "O&" taking an object constructor a void*
Guido van Rossum <guido@python.org>
parents:
2154
diff
changeset
|
521 } |
|
9894e55468ec
support "O&" taking an object constructor a void*
Guido van Rossum <guido@python.org>
parents:
2154
diff
changeset
|
522 else { |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
523 PyObject *v; |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
524 v = va_arg(*p_va, PyObject *); |
|
9722
3955f787e9a1
Oops, forgot a pair of {}'s. (Greg Couch)
Guido van Rossum <guido@python.org>
parents:
9720
diff
changeset
|
525 if (v != NULL) { |
|
9720
24ca64134594
Add 'N' format character to Py_BuildValue -- like 'O' but doesn't INCREF.
Guido van Rossum <guido@python.org>
parents:
9044
diff
changeset
|
526 if (*(*p_format - 1) != 'N') |
|
24ca64134594
Add 'N' format character to Py_BuildValue -- like 'O' but doesn't INCREF.
Guido van Rossum <guido@python.org>
parents:
9044
diff
changeset
|
527 Py_INCREF(v); |
|
9722
3955f787e9a1
Oops, forgot a pair of {}'s. (Greg Couch)
Guido van Rossum <guido@python.org>
parents:
9720
diff
changeset
|
528 } |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
529 else if (!PyErr_Occurred()) |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
530 /* If a NULL was passed |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
531 * because a call that should |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
532 * have constructed a value |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
533 * failed, that's OK, and we |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
534 * pass the error on; but if |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
535 * no error occurred it's not |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
536 * clear that the caller knew |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
537 * what she was doing. */ |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
538 PyErr_SetString(PyExc_SystemError, |
|
8640
8e86a797e596
Two error messages still used the old name of the functio mkvalue() --
Guido van Rossum <guido@python.org>
parents:
6613
diff
changeset
|
539 "NULL object passed to Py_BuildValue"); |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
540 return v; |
|
816
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
541 } |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
542 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
543 case ':': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
544 case ',': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
545 case ' ': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
546 case '\t': |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
547 break; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
548 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
549 default: |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
550 PyErr_SetString(PyExc_SystemError, |
|
8640
8e86a797e596
Two error messages still used the old name of the functio mkvalue() --
Guido van Rossum <guido@python.org>
parents:
6613
diff
changeset
|
551 "bad format char passed to Py_BuildValue"); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
552 return NULL; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
553 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
554 } |
|
816
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
555 } |
|
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
556 } |
|
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
557 |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
558 |
|
27533
842d6a24497a
Style consistency, so "grep ^function ..." works as expected.
Fred Drake <fdrake@acm.org>
parents:
26664
diff
changeset
|
559 PyObject * |
|
35999
9541369b0dca
Add const to several API functions that take char *.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
35935
diff
changeset
|
560 Py_BuildValue(const char *format, ...) |
|
816
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
561 { |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
562 va_list va; |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
563 PyObject* retval; |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
564 va_start(va, format); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
565 retval = va_build_value(format, va, 0); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
566 va_end(va); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
567 return retval; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
568 } |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
569 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
570 PyObject * |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
571 _Py_BuildValue_SizeT(const char *format, ...) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
572 { |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
573 va_list va; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
574 PyObject* retval; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
575 va_start(va, format); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
576 retval = va_build_value(format, va, FLAG_SIZE_T); |
|
817
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
577 va_end(va); |
|
aa633f0defa6
Merged with Steve Miale's version
Guido van Rossum <guido@python.org>
parents:
816
diff
changeset
|
578 return retval; |
|
816
e4a27d84ea36
Added mkvalue() function
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
579 } |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1211
diff
changeset
|
580 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
581 PyObject * |
|
35999
9541369b0dca
Add const to several API functions that take char *.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
35935
diff
changeset
|
582 Py_VaBuildValue(const char *format, va_list va) |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1211
diff
changeset
|
583 { |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
584 return va_build_value(format, va, 0); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
585 } |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
586 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
587 PyObject * |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
588 _Py_VaBuildValue_SizeT(const char *format, va_list va) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
589 { |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
590 return va_build_value(format, va, FLAG_SIZE_T); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
591 } |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
592 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
593 static PyObject * |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
594 va_build_value(const char *format, va_list va, int flags) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
595 { |
|
35999
9541369b0dca
Add const to several API functions that take char *.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
35935
diff
changeset
|
596 const char *f = format; |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1211
diff
changeset
|
597 int n = countformat(f, '\0'); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
598 va_list lva; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
599 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
600 #ifdef VA_LIST_IS_ARRAY |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
601 memcpy(lva, va, sizeof(va_list)); |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
602 #else |
|
24400
81ca6ca5c307
Patch #554716: Use __va_copy where available.
Martin v. Löwis <martin@v.loewis.de>
parents:
23888
diff
changeset
|
603 #ifdef __va_copy |
|
81ca6ca5c307
Patch #554716: Use __va_copy where available.
Martin v. Löwis <martin@v.loewis.de>
parents:
23888
diff
changeset
|
604 __va_copy(lva, va); |
|
81ca6ca5c307
Patch #554716: Use __va_copy where available.
Martin v. Löwis <martin@v.loewis.de>
parents:
23888
diff
changeset
|
605 #else |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
606 lva = va; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
607 #endif |
|
24400
81ca6ca5c307
Patch #554716: Use __va_copy where available.
Martin v. Löwis <martin@v.loewis.de>
parents:
23888
diff
changeset
|
608 #endif |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
609 |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1211
diff
changeset
|
610 if (n < 0) |
|
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1211
diff
changeset
|
611 return NULL; |
|
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1211
diff
changeset
|
612 if (n == 0) { |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
613 Py_INCREF(Py_None); |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
614 return Py_None; |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1211
diff
changeset
|
615 } |
|
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1211
diff
changeset
|
616 if (n == 1) |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
617 return do_mkvalue(&f, &lva, flags); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36858
diff
changeset
|
618 return do_mktuple(&f, &lva, '\0', n, flags); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
619 } |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
620 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
621 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
622 PyObject * |
|
35999
9541369b0dca
Add const to several API functions that take char *.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
35935
diff
changeset
|
623 PyEval_CallFunction(PyObject *obj, const char *format, ...) |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
624 { |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
625 va_list vargs; |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
626 PyObject *args; |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
627 PyObject *res; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
628 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
629 va_start(vargs, format); |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
630 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
631 args = Py_VaBuildValue(format, vargs); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
632 va_end(vargs); |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
633 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
634 if (args == NULL) |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
635 return NULL; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
636 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
637 res = PyEval_CallObject(obj, args); |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
638 Py_DECREF(args); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
639 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
640 return res; |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1211
diff
changeset
|
641 } |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
642 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
643 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
644 PyObject * |
|
35999
9541369b0dca
Add const to several API functions that take char *.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
35935
diff
changeset
|
645 PyEval_CallMethod(PyObject *obj, const char *methodname, const char *format, ...) |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
646 { |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
647 va_list vargs; |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
648 PyObject *meth; |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
649 PyObject *args; |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
650 PyObject *res; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
651 |
|
8898
492363d6bc94
# Fix strange type (methonname instead of methodname).
Guido van Rossum <guido@python.org>
parents:
8822
diff
changeset
|
652 meth = PyObject_GetAttrString(obj, methodname); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
653 if (meth == NULL) |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
654 return NULL; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
655 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
656 va_start(vargs, format); |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
657 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
658 args = Py_VaBuildValue(format, vargs); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
659 va_end(vargs); |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
660 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
661 if (args == NULL) { |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
662 Py_DECREF(meth); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
663 return NULL; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
664 } |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
665 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
666 res = PyEval_CallObject(meth, args); |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
667 Py_DECREF(meth); |
|
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
668 Py_DECREF(args); |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
669 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
670 return res; |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
1913
diff
changeset
|
671 } |
|
14781
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
672 |
|
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
673 int |
|
35999
9541369b0dca
Add const to several API functions that take char *.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
35935
diff
changeset
|
674 PyModule_AddObject(PyObject *m, const char *name, PyObject *o) |
|
14781
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
675 { |
|
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
676 PyObject *dict; |
| 29579 | 677 if (!PyModule_Check(m)) { |
|
23888
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
678 PyErr_SetString(PyExc_TypeError, |
|
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
679 "PyModule_AddObject() needs module as first arg"); |
|
14781
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
680 return -1; |
|
23888
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
681 } |
| 29579 | 682 if (!o) { |
|
30771
a6879d1733d7
Patch #828384: Don't discard nested exception in AddObject.
Martin v. Löwis <martin@v.loewis.de>
parents:
29579
diff
changeset
|
683 if (!PyErr_Occurred()) |
|
a6879d1733d7
Patch #828384: Don't discard nested exception in AddObject.
Martin v. Löwis <martin@v.loewis.de>
parents:
29579
diff
changeset
|
684 PyErr_SetString(PyExc_TypeError, |
|
a6879d1733d7
Patch #828384: Don't discard nested exception in AddObject.
Martin v. Löwis <martin@v.loewis.de>
parents:
29579
diff
changeset
|
685 "PyModule_AddObject() needs non-NULL value"); |
| 29579 | 686 return -1; |
| 687 } | |
| 688 | |
|
23888
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
689 dict = PyModule_GetDict(m); |
|
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
690 if (dict == NULL) { |
|
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
691 /* Internal error -- modules must have a dict! */ |
|
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
692 PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", |
|
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
693 PyModule_GetName(m)); |
|
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
694 return -1; |
|
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
695 } |
|
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
696 if (PyDict_SetItemString(dict, name, o)) |
|
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
697 return -1; |
|
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
698 Py_DECREF(o); |
|
7b66f0034233
PyModule_AddObject(): Added missing exceptions.
Fred Drake <fdrake@acm.org>
parents:
22613
diff
changeset
|
699 return 0; |
|
14781
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
700 } |
|
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
701 |
|
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
702 int |
|
35999
9541369b0dca
Add const to several API functions that take char *.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
35935
diff
changeset
|
703 PyModule_AddIntConstant(PyObject *m, const char *name, long value) |
|
14781
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
704 { |
|
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
705 return PyModule_AddObject(m, name, PyInt_FromLong(value)); |
|
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
706 } |
|
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
707 |
|
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
708 int |
|
35999
9541369b0dca
Add const to several API functions that take char *.
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
35935
diff
changeset
|
709 PyModule_AddStringConstant(PyObject *m, const char *name, const char *value) |
|
14781
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
710 { |
|
42013
cd125fe83051
Make identifiers str (not str8) objects throughout.
Martin v. Löwis <martin@v.loewis.de>
parents:
41766
diff
changeset
|
711 return PyModule_AddObject(m, name, PyUnicode_FromString(value)); |
|
14781
081671cef7c1
Andrew Kuchling <akuchlin@mems-exchange.org>:
Fred Drake <fdrake@acm.org>
parents:
14588
diff
changeset
|
712 } |
