summaryrefslogtreecommitdiffstats
path: root/Python/modsupport.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-1635741: Add PyModule_AddObjectRef() function (GH-23122)Victor Stinner2020-11-041-31/+39
| | | | | Added PyModule_AddObjectRef() function: similar to PyModule_AddObjectRef() but don't steal a reference to the value on success.
* closes bpo-41533: Fix a potential memory leak when allocating a stack (GH-21847)Tony Solomonik2020-08-301-0/+3
| | | | Free the stack allocated in va_build_stack if do_mkstack fails and the stack is not a small_stack
* bpo-40943: PY_SSIZE_T_CLEAN required for '#' formats (GH-20784)Victor Stinner2020-06-191-15/+18
| | | | | | | The PY_SSIZE_T_CLEAN macro must now be defined to use PyArg_ParseTuple() and Py_BuildValue() "#" formats: "es#", "et#", "s#", "u#", "y#", "z#", "U#" and "Z#". See the PEP 353. Update _testcapi.test_buildvalue_issue38913().
* bpo-40170: Add _PyIndex_Check() internal function (GH-19426)Victor Stinner2020-04-081-1/+2
| | | | | | | | | Add _PyIndex_Check() function to the internal C API: fast inlined verson of PyIndex_Check(). Add Include/internal/pycore_abstract.h header file. Replace PyIndex_Check() with _PyIndex_Check() in C files of Objects and Python subdirectories.
* bpo-40024: Add PyModule_AddType() helper function (GH-19088)Dong-hee Na2020-03-221-0/+19
|
* bpo-38913: Fix segfault in Py_BuildValue("(s#O)", ...) if entered with ↵Serhiy Storchaka2020-03-021-3/+3
| | | | exception raised. (GH-18656)
* bpo-36381: warn when no PY_SSIZE_T_CLEAN defined (GH-12473)Inada Naoki2019-03-231-3/+18
| | | We will remove int support from 3.10 or 4.0.
* bpo-29852: Argument Clinic Py_ssize_t converter now supports None (#716)Serhiy Storchaka2017-03-301-0/+25
| | | if pass `accept={int, NoneType}`.
* bpo-29524: Add Objects/call.c file (#12)Victor Stinner2017-02-121-51/+0
| | | | | | | | | * Move all functions to call objects in a new Objects/call.c file. * Rename fast_function() to _PyFunction_FastCallKeywords(). * Copy null_error() from Objects/abstract.c * Inline type_error() in call.c to not have to copy it, it was only called once. * Export _PyEval_EvalCodeWithName() since it is now called from call.c.
* Backed out changeset f23fa1f7b68fVictor Stinner2017-02-101-0/+51
| | | | | Sorry, I didn't want to push this change before the review :-( I was pushing a change into the 2.7 branch.
* Issue #29465: Add Objects/call.c fileVictor Stinner2017-02-101-51/+0
| | | | | | | | | | * Move all functions to call objects in a new Objects/call.c file. * Rename fast_function() to _PyFunction_FastCallKeywords(). * Copy null_error() from Objects/abstract.c * Inline type_error() in call.c to not have to copy it, it was only called once. * Export _PyEval_EvalCodeWithName() since it is now called from call.c.
* Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE whereverSerhiy Storchaka2017-01-231-2/+1
| | | | possible. Patch is writen with Coccinelle.
* Add _Py_VaBuildStack() functionVictor Stinner2016-12-081-0/+98
| | | | | Issue #28915: Similar to Py_VaBuildValue(), but work on a C array of PyObject*, instead of creating a tuple.
* modsupport: replace int with Py_ssize_tVictor Stinner2016-12-081-8/+8
| | | | | | | | Issue #28915: Py_ssize_t type is better for indexes. The compiler might emit more efficient code for i++. Py_ssize_t is the type of a PyTuple index for example. Replace also "int endchar" with "char endchar".
* modsupport: replace int with Py_ssize_tVictor Stinner2016-12-081-17/+20
| | | | Issue #28915.
* Uniformize argument names of "call" functionsVictor Stinner2016-12-061-4/+4
| | | | | | | | | | | | Issue #28838: Rename parameters of the "calls" functions of the Python C API. * Rename 'callable_object' and 'func' to 'callable': any Python callable object is accepted, not only Python functions * Rename 'method' and 'nameid' to 'name' (method name) * Rename 'o' to 'obj' * Move, fix and update documentation of PyObject_CallXXX() functions in abstract.h * Update also the documentaton of the C API (update parameter names)
* Issue #28748: Private variable _Py_PackageContext is now of type "const char *"Serhiy Storchaka2016-11-211-1/+1
| | | | rather of "char *".
* Issue #19569: Compiler warnings are now emitted if use most of deprecatedSerhiy Storchaka2016-11-201-2/+2
| | | | functions.
* va_end() all va_copy()ed va_lists.Christian Heimes2016-09-211-5/+9
|
* replace usage of Py_VA_COPY with the (C99) standard va_copyBenjamin Peterson2016-09-211-1/+1
|
* replace PY_LONG_LONG with long longBenjamin Peterson2016-09-061-2/+2
|
* Avoid inefficient way to call functions without argumentVictor Stinner2016-09-061-1/+1
| | | | | | Don't pass "()" format to PyObject_CallXXX() to call a function without argument: pass NULL as the format string instead. It avoids to have to parse a string to produce 0 argument.
* require a long long data type (closes #27961)Benjamin Peterson2016-09-061-2/+1
|
* Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N"Serhiy Storchaka2016-05-201-53/+70
|\ | | | | | | format unit.
| * Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N"Serhiy Storchaka2016-05-201-53/+70
| | | | | | | | format unit.
* | Issue #25923: Added more const qualifiers to signatures of static and ↵Serhiy Storchaka2015-12-251-2/+2
|/ | | | private functions.
* Issue #20024: Py_BuildValue() now saves/restores the current exception beforeVictor Stinner2014-01-211-1/+11
| | | | building an item if the build of a previous item failed.
* modsupport.c reuses Py_UNICODE_strlen()Victor Stinner2011-09-291-10/+1
|
* Py_BuildValue("C") supports non-BMP characters on narrow buildVictor Stinner2011-07-141-5/+0
| | | | | | Py_BuildValue("C") doesn't have to check the code point, PyUnicode_FromOrdinal() checks its input and now supports non-BMP characters (range U+10000-U+10FFFF).
* Issue #2443: Added a new macro, Py_VA_COPY, which is equivalent to C99Alexander Belopolsky2010-08-111-9/+1
| | | | | va_copy, but available on all python platforms. Untabified a few unrelated files.
* Issue #8848: U / U# formats of Py_BuildValue() are just alias to s / s#Victor Stinner2010-06-071-33/+1
|
* Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou2010-05-091-484/+484
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
* Issue 7147 - remove ability to attempt to build Python without complex ↵Skip Montanaro2009-10-181-2/+0
| | | | number support (was broken anyway)
* Py_BuildValue's 'c' code should use byte strings #5666Benjamin Peterson2009-04-031-1/+1
|
* Correct a typo during previous checkin.Amaury Forgeot d'Arc2008-07-041-1/+1
|
* Issue #3280: like chr() already does, the "%c" format now accepts the full ↵Amaury Forgeot d'Arc2008-07-041-11/+2
| | | | | | unicode range even on "narrow Unicode" builds; the result is a pair of UTF-16 surrogates.
* Implement PEP 3121: new module initialization and finalization API.Martin v. Löwis2008-06-111-92/+0
|
* Renamed PyString to PyBytesChristian Heimes2008-05-261-1/+1
|
* Merged revisions 60080-60089,60091-60093 via svnmerge fromGeorg Brandl2008-01-191-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r60080 | andrew.kuchling | 2008-01-19 17:26:13 +0100 (Sat, 19 Jan 2008) | 2 lines Patch #742598 from Michael Pomraning: add .timeout attribute to SocketServer that will call .handle_timeout() method when no requests are received within the timeout period. ........ r60081 | andrew.kuchling | 2008-01-19 17:34:09 +0100 (Sat, 19 Jan 2008) | 1 line Add item ........ r60082 | christian.heimes | 2008-01-19 17:39:27 +0100 (Sat, 19 Jan 2008) | 2 lines Disabled test_xmlrpc:test_404. It's causing lots of false alarms. I also disabled a test in test_ssl which requires network access to svn.python.org. This fixes a bug Skip has reported a while ago. ........ r60083 | georg.brandl | 2008-01-19 18:38:53 +0100 (Sat, 19 Jan 2008) | 2 lines Clarify thread.join() docs. #1873. ........ r60084 | georg.brandl | 2008-01-19 19:02:46 +0100 (Sat, 19 Jan 2008) | 2 lines #1782: don't leak in error case in PyModule_AddXxxConstant. Patch by Hrvoje Nik?\197?\161i?\196?\135. ........ r60085 | andrew.kuchling | 2008-01-19 19:08:52 +0100 (Sat, 19 Jan 2008) | 1 line Sort two names into position ........ r60086 | andrew.kuchling | 2008-01-19 19:18:41 +0100 (Sat, 19 Jan 2008) | 2 lines Patch #976880: add mmap .rfind() method, and 'end' paramter to .find(). Contributed by John Lenton. ........ r60087 | facundo.batista | 2008-01-19 19:38:19 +0100 (Sat, 19 Jan 2008) | 5 lines Fix #1693149. Now you can pass several modules separated by coma to trace.py in the same --ignore-module option. Thanks Raghuram Devarakonda. ........ r60088 | facundo.batista | 2008-01-19 19:45:46 +0100 (Sat, 19 Jan 2008) | 3 lines Comment in NEWS regarding the change in trace.py. ........ r60089 | skip.montanaro | 2008-01-19 19:47:24 +0100 (Sat, 19 Jan 2008) | 2 lines missing from r60088 checkin. ........ r60091 | andrew.kuchling | 2008-01-19 20:14:05 +0100 (Sat, 19 Jan 2008) | 1 line Add item ........ r60092 | georg.brandl | 2008-01-19 20:27:05 +0100 (Sat, 19 Jan 2008) | 4 lines Fix #1679: "0x" was taken as a valid integer literal. Fixes the tokenizer, tokenize.py and int() to reject this. Patches by Malte Helmert. ........ r60093 | georg.brandl | 2008-01-19 20:48:19 +0100 (Sat, 19 Jan 2008) | 3 lines Fix #1146: TextWrap vs words 1-character shorter than the width. Patch by Quentin Gallet-Gilles. ........
* Eliminate outdated usages of PyInt_GetMax.Martin v. Löwis2007-12-041-8/+2
|
* Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases ↵Christian Heimes2007-12-021-7/+7
| | | | in intobject.h
* Merging the py3k-pep3137 branch back into the py3k branch.Guido van Rossum2007-11-061-1/+1
| | | | | | | | | | | | | | No detailed change log; just check out the change log for the py3k-pep3137 branch. The most obvious changes: - str8 renamed to bytes (PyString at the C level); - bytes renamed to buffer (PyBytes at the C level); - PyString and PyUnicode are no longer compatible. I.e. we now have an immutable bytes type and a mutable bytes type. The behavior of PyString was modified quite a bit, to make it more bytes-like. Some changes are still on the to-do list.
* PyErr_Warn is deprecated in 2.5 - goes away for 3.0Skip Montanaro2007-08-121-1/+1
|
* Change Py_BuildValue to generate Unicode objects forMartin v. Löwis2007-07-181-2/+2
| | | | | | | | 's' and 'c' codes. Change pickle to dump bytes objects using the 'S' code, and to load the 'S' code as byte objects. Change datetime and array to generate and expect bytes objects in reduce/unreduce.
* Revert r56044 (which changed the %c format specifier to accept aWalter Dörwald2007-07-011-0/+6
| | | | unicode char into an int variable) and add %C which does this.
* Change %c format specifier for PyArg_ParseTuple() so that it acceptsWalter Dörwald2007-06-201-3/+16
| | | | | | | | | | a unicode character (an int * must be passed as the argument). Change %c format specifier for Py_BuildValue() so that it outputs a unicode object. Fix datetime.datetime.isoformat(), so that it works if sep is a unicode character > U+00FF.
* Make module docstrings unicode objects.Walter Dörwald2007-06-121-1/+1
|
* Make identifiers str (not str8) objects throughout.Martin v. Löwis2007-06-101-2/+2
| | | | | | | | | | | | | | | | | | | This affects the parser, various object implementations, and all places that put identifiers into C string literals. In testing, a number of crashes occurred as code would fail when the recursion limit was reached (such as the Unicode interning dictionary having key/value pairs where key is not value). To solve these, I added an overflowed flag, which allows for 50 more recursions after the limit was reached and the exception was raised, and a recursion_critical flag, which indicates that recursion absolutely must be allowed, i.e. that a certain call must not cause a stack overflow exception. There are still some places where both str and str8 are accepted as identifiers; these should eventually be removed.
* Add 'U'/'U#' format characters to Py_BuildValue (and thusWalter Dörwald2007-05-181-0/+33
| | | | | | | | | | | | | | to PyObject_CallFunction()) that take a char * (and a size in the case of 'U#') and create a unicode object out of it. Add functions PyUnicode_FromFormat() and PyUnicode_FromFormatV() that work similar to PyString_FromFormat(), but create a unicode object (also a %U format character has been added, that takes a PyObject *, which must point to a unicode object). Change the encoding and reason attributes of UnicodeEncodeError, UnicodeDecodeError and UnicodeTranslateError to be unicode objects.
* Change UnicodeDecodeError objects so that the 'object' attributeWalter Dörwald2007-05-041-0/+33
| | | | | | | is a bytes object. Add 'y' and 'y#' format specifiers that work like 's' and 's#' but only accept bytes objects.