summaryrefslogtreecommitdiffstats
path: root/Include/modsupport.h
Commit message (Collapse)AuthorAgeFilesLines
* gh-112136: Restore removed _PyArg_Parser (#121262)Victor Stinner2024-07-031-0/+6
| | | | | | | Restore the private _PyArg_Parser structure and the private _PyArg_ParseTupleAndKeywordsFast() function, previously removed in Python 3.13 alpha 1. Recreate Include/cpython/modsupport.h header file.
* gh-65210: Add const qualifiers in PyArg_VaParseTupleAndKeywords() (GH-105958)Serhiy Storchaka2023-12-041-2/+2
| | | | | | | | | | | Change the declaration of the keywords parameter in functions PyArg_ParseTupleAndKeywords() and PyArg_VaParseTupleAndKeywords() from `char **` to `char * const *` in C and `const char * const *` in C++. It makes these functions compatible with argument of type `const char * const *`, `const char **` or `char * const *` in C++ and `char * const *` in C without explicit type cast. Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
* gh-110964: Remove private _PyArg functions (#110966)Victor Stinner2023-10-171-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the following private functions and structures to pycore_modsupport.h internal C API: * _PyArg_BadArgument() * _PyArg_CheckPositional() * _PyArg_NoKeywords() * _PyArg_NoPositional() * _PyArg_ParseStack() * _PyArg_ParseStackAndKeywords() * _PyArg_Parser structure * _PyArg_UnpackKeywords() * _PyArg_UnpackKeywordsWithVararg() * _PyArg_UnpackStack() * _Py_ANY_VARARGS() Changes: * Python/getargs.h now includes pycore_modsupport.h to export functions. * clinic.py now adds pycore_modsupport.h when one of these functions is used. * Add pycore_modsupport.h includes when a C extension uses one of these functions. * Define Py_BUILD_CORE_MODULE in C extensions which now include directly or indirectly (via code generated by Argument Clinic) pycore_modsupport.h: * _csv * _curses_panel * _dbm * _gdbm * _multiprocessing.posixshmem * _sqlite.row * _statistics * grp * resource * syslog * _testcapi: bad_get() no longer uses METH_FASTCALL calling convention but METH_VARARGS. Replace _PyArg_UnpackStack() with PyArg_ParseTuple(). * _testcapi: add PYTESTCAPI_NEED_INTERNAL_API macro which is defined by _testcapi sub-modules which need the internal C API (pycore_modsupport.h): exceptions.c, float.c, vectorcall.c, watchers.c. * Remove Include/cpython/modsupport.h header file. Include/modsupport.h no longer includes the removed header file. * Fix mypy clinic.py
* gh-108765: Move standard includes to Python.h (#108769)Victor Stinner2023-09-011-4/+1
| | | | | | | | | | | | * Move <ctype.h>, <limits.h> and <stdarg.h> standard includes to Python.h. * Move "pystats.h" include from object.h to Python.h. * Remove redundant "pymem.h" include in objimpl.h and "pyport.h" include in pymem.h; Python.h already includes them earlier. * Remove redundant <wchar.h> include in unicodeobject.h; Python.h already includes it. * Move _SGI_MP_SOURCE define from Python.h to pyport.h. * pycore_condvar.h includes explicitly <unistd.h> for the _POSIX_THREADS macro.
* gh-108634: Py_TRACE_REFS uses a hash table (#108663)Victor Stinner2023-08-311-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python built with "configure --with-trace-refs" (tracing references) is now ABI compatible with Python release build and debug build. Moreover, it now also supports the Limited API. Change Py_TRACE_REFS build: * Remove _PyObject_EXTRA_INIT macro. * The PyObject structure no longer has two extra members (_ob_prev and _ob_next). * Use a hash table (_Py_hashtable_t) to trace references (all objects): PyInterpreterState.object_state.refchain. * Py_TRACE_REFS build is now ABI compatible with release build and debug build. * Limited C API extensions can now be built with Py_TRACE_REFS: xxlimited, xxlimited_35, _testclinic_limited. * No longer rename PyModule_Create2() and PyModule_FromDefAndSpec2() functions to PyModule_Create2TraceRefs() and PyModule_FromDefAndSpec2TraceRefs(). * _Py_PrintReferenceAddresses() is now called before finalize_interp_delete() which deletes the refchain hash table. * test_tracemalloc find_trace() now also filters by size to ignore the memory allocated by _PyRefchain_Trace(). Test changes for Py_TRACE_REFS: * Add test.support.Py_TRACE_REFS constant. * Add test_sys.test_getobjects() to test sys.getobjects() function. * test_exceptions skips test_recursion_normalizing_with_no_memory() and test_memory_error_in_PyErr_PrintEx() if Python is built with Py_TRACE_REFS. * test_repl skips test_no_memory(). * test_capi skisp test_set_nomemory().
* gh-107226: PyModule_AddObjectRef() should only be in the limited API 3.10 ↵Serhiy Storchaka2023-07-251-0/+2
| | | | (GH-107227)
* bpo-42327: C API: Add PyModule_Add() function (GH-23443)Serhiy Storchaka2023-07-181-3/+9
| | | | | It is a fixed implementation of PyModule_AddObject() which consistently steals reference both on success and on failure.
* gh-104922: Make `PY_SSIZE_T_CLEAN` not mandatory again (#105051)Inada Naoki2023-05-311-20/+3
|
* gh-87347: Add parenthesis around macro arguments (#93915)Victor Stinner2022-06-201-6/+6
| | | Add unit test on Py_MEMBER_SIZE() and some other macros.
* Remove ANY_VARARGS() macro from the C API (#93764)Victor Stinner2022-06-131-2/+0
| | | The macro was exposed by mistake.
* gh-79315: Add Include/cpython/modsupport.h header (#91797)Victor Stinner2022-04-211-106/+6
|
* bpo-45316: Move _PyArg_Fini() to internal C API (GH-31580)Victor Stinner2022-02-251-2/+0
| | | | Move the private unexported _PyArg_Fini() function to the internal C API: to the pycore_pylifecycle.h header file.
* bpo-45459: C API uses type names rather than structure names (GH-31528)Victor Stinner2022-02-241-4/+2
| | | | Thanks to the new pytypedefs.h, it becomes to use type names like PyObject rather like structure names like "struct _object".
* bpo-45434: bytearrayobject.h no longer includes <stdarg.h> (GH-28913)Victor Stinner2021-10-131-1/+1
| | | | bytearrayobject.h and _lzmamodule.c don't use va_list and so don't need to include <stdarg.h>.
* bpo-20201: variadic arguments support for AC (GH-18609)Batuhan Taskaya2021-07-161-1/+10
| | | Implement support for `*args` in AC, and port `print()` to use it.
* bpo-1635741: Add PyModule_AddObjectRef() function (GH-23122)Victor Stinner2020-11-041-1/+9
| | | | | Added PyModule_AddObjectRef() function: similar to PyModule_AddObjectRef() but don't steal a reference to the value on success.
* bpo-40024: Add PyModule_AddType() helper function (GH-19088)Dong-hee Na2020-03-221-0/+4
|
* bpo-37207: Add _PyArg_NoKwnames() helper function (GH-18980)Dong-hee Na2020-03-161-0/+3
|
* bpo-37034: Display argument name on errors with keyword arguments with ↵Rémi Lapeyre2019-08-291-1/+1
| | | | Argument Clinic. (GH-13593)
* bpo-36127: Argument Clinic: inline parsing code for keyword parameters. ↵Serhiy Storchaka2019-03-141-0/+12
| | | | (GH-12058)
* bpo-35582: Argument Clinic: inline parsing code for positional parameters. ↵Serhiy Storchaka2019-01-111-1/+6
| | | | (GH-11313)
* bpo-23867: Argument Clinic: inline parsing code for a single positional ↵Serhiy Storchaka2018-12-251-0/+2
| | | | parameter. (GH-9689)
* bpo-32240: Add the const qualifier to declarations of PyObject* array ↵Serhiy Storchaka2017-12-151-3/+3
| | | | arguments. (#4746)
* bpo-28411: Isolate PyInterpreterState.modules (#3575)Eric Snow2017-09-141-0/+4
| | | | | A bunch of code currently uses PyInterpreterState.modules directly instead of PyImport_GetModuleDict(). This complicates efforts to make changes relative to sys.modules. This patch switches to using PyImport_GetModuleDict() uniformly. Also, a number of related uses of sys.modules are updated for uniformity for the same reason. Note that this code was already reviewed and merged as part of #1638. I reverted that and am now splitting it up into more focused parts.
* bpo-31404: Revert "remove modules from Py_InterpreterState (#1638)" (#3565)Eric Snow2017-09-141-4/+0
| | | PR #1638, for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506, a fix on top of #1638, is also getting reverted.
* bpo-28411: Remove "modules" field from Py_InterpreterState. (#1638)Eric Snow2017-09-041-0/+4
| | | sys.modules is the one true source.
* Remove _PyArg_NoStackKeywords(). (#2641)Serhiy Storchaka2017-07-101-3/+0
|
* Issue #29460: _PyArg_NoKeywords(), _PyArg_NoStackKeywords() andSerhiy Storchaka2017-02-061-0/+7
| | | | _PyArg_NoPositional() now are macros.
* Issue #29083: Fixed the declaration of some public API functions.Serhiy Storchaka2017-01-241-7/+5
|\ | | | | | | | | | | | | PyArg_VaParse() and PyArg_VaParseTupleAndKeywords() were not available in limited API. PyArg_ValidateKeywordArguments(), PyArg_UnpackTuple() and Py_BuildValue() were not available in limited API of version < 3.3 when PY_SSIZE_T_CLEAN is defined.
| * Issue #29083: Fixed the declaration of some public API functions.Serhiy Storchaka2017-01-241-7/+5
| |\ | | | | | | | | | | | | | | | | | | PyArg_VaParse() and PyArg_VaParseTupleAndKeywords() were not available in limited API. PyArg_ValidateKeywordArguments(), PyArg_UnpackTuple() and Py_BuildValue() were not available in limited API of version < 3.3 when PY_SSIZE_T_CLEAN is defined.
| | * Issue #29083: Fixed the declaration of some public API functions.Serhiy Storchaka2017-01-241-5/+5
| | | | | | | | | | | | | | | | | | | | | PyArg_VaParse() and PyArg_VaParseTupleAndKeywords() were not available in limited API. PyArg_ValidateKeywordArguments(), PyArg_UnpackTuple() and Py_BuildValue() were not available in limited API of version < 3.3 when PY_SSIZE_T_CLEAN is defined.
* | | Add _PyArg_UnpackStack() function helperVictor Stinner2017-01-171-0/+10
| | | | | | | | | | | | Issue #29286.
* | | Add _PyArg_NoStackKeywords() helper functionVictor Stinner2017-01-171-1/+2
| | | | | | | | | | | | | | | Issue #29286. Similar to _PyArg_NoKeywords(), but expects a tuple of keyword names, instead of a dict.
* | | Add _PyArg_ParseStack() helper functionVictor Stinner2017-01-171-3/+13
| | | | | | | | | | | | | | | Issue #29286. Function similar to PyArg_ParseTuple(), but uses a C array of PyObject* to pass arguments. Don't support the compatibility mode.
* | | Rename _PyArg_ParseStack to _PyArg_ParseStackAndKeywordsVictor Stinner2017-01-171-2/+2
| | | | | | | | | | | | Issue #29286.
* | | Issue #28915: Exclude _Py_VaBuildStack from the limited API.Serhiy Storchaka2016-12-271-0/+4
| | |
* | | Add _Py_VaBuildStack() functionVictor Stinner2016-12-081-0/+13
| | | | | | | | | | | | | | | Issue #28915: Similar to Py_VaBuildValue(), but work on a C array of PyObject*, instead of creating a tuple.
* | | Issue #28748: Private variable _Py_PackageContext is now of type "const char *"Serhiy Storchaka2016-11-211-1/+1
|/ / | | | | | | rather of "char *".
* | Issue #26900: Excluded underscored names and other private API from limited API.Serhiy Storchaka2016-09-111-0/+4
| |
* | Emit METH_FASTCALL code in Argument ClinicVictor Stinner2016-09-101-0/+3
| | | | | | | | | | | | | | | | | | Issue #27810: * Modify vgetargskeywordsfast() to work on a C array of PyObject* rather than working on a tuple directly. * Add _PyArg_ParseStack() * Argument Clinic now emits code using the new METH_FASTCALL calling convention
* | Issue #27574: Decreased an overhead of parsing keyword arguments in functionsSerhiy Storchaka2016-08-141-0/+23
|/ | | | implemented with using Argument Clinic.
* Issue 24365: Conditionalize PEP 489 additions to the stable ABIYury Selivanov2015-06-021-1/+8
| | | | Patch by Petr Viktorin.
* PEP 489: Multi-phase extension module initializationNick Coghlan2015-05-231-23/+39
| | | | | | | | | | | | | | | | | | | | | | | Known limitations of the current implementation: - documentation changes are incomplete - there's a reference leak I haven't tracked down yet The leak is most visible by running: ./python -m test -R3:3 test_importlib However, you can also see it by running: ./python -X showrefcount Importing the array or _testmultiphase modules, and then deleting them from both sys.modules and the local namespace shows significant increases in the total number of active references each cycle. By contrast, with _testcapi (which continues to use single-phase initialisation) the global refcounts stabilise after a couple of cycles.
* Issue #20294: Argument Clinic now supports argument parsing for __new__ andLarry Hastings2014-01-191-0/+1
| | | | __init__ functions.
* remove support GCC PyArg_ParseTuple format patch, last seen in 2006Benjamin Peterson2013-05-131-1/+1
|
* Issue #11626: Add _SizeT functions to stable ABI.Martin v. Löwis2012-06-231-1/+4
|
* Merge branches/pep-0384.Martin v. Löwis2010-12-031-0/+15
|
* prevent the dict constructor from accepting non-string keyword args #8419Benjamin Peterson2010-04-241-0/+1
| | | | | This adds PyArg_ValidateKeywordArguments, which checks that keyword arguments are all strings, using an optimized method if possible.
* #5735: Modules compiled with incompatible settings (--with-pydebug when ↵Amaury Forgeot d'Arc2009-06-011-2/+2
| | | | | | | | python is not) should generate a link-time error. I won't backport to 3.0, because it breaks binary compatibility
* Issue #6012: Add cleanup support to O& argument parsing.Martin v. Löwis2009-05-291-0/+2
|