summaryrefslogtreecommitdiffstats
path: root/Modules/xxlimited.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-116322: Add Py_mod_gil module slot (#116882)Brett Simmers2024-05-031-2/+3
| | | | | | | | | | | | | | This PR adds the ability to enable the GIL if it was disabled at interpreter startup, and modifies the multi-phase module initialization path to enable the GIL when loading a module, unless that module's spec includes a slot indicating it can run safely without the GIL. PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148. A warning will be issued up to once per interpreter for the first GIL-using module that is loaded. If `-v` is given, a shorter message will be printed to stderr every time a GIL-using module is loaded (including the first one that issues a warning).
* gh-108494: Fix Argument Clinic LIMITED_CAPI_REGEX (#116610)Victor Stinner2024-03-111-3/+2
| | | Accept spaces in "# define Py_LIMITED_API 0x030d0000".
* gh-111650: Ensure pyconfig.h includes Py_GIL_DISABLED on Windows (GH-112778)Steve Dower2023-12-131-2/+0
|
* gh-111863: Rename `Py_NOGIL` to `Py_GIL_DISABLED` (#111864)Hugo van Kemenade2023-11-201-2/+2
| | | Rename Py_NOGIL to Py_GIL_DISABLED
* gh-110968: Py_MOD_PER_INTERPRETER_GIL_SUPPORTED was added to 3.12 (#111584)Victor Stinner2023-11-011-2/+2
|
* gh-110481: Implement biased reference counting (gh-110764)Sam Gross2023-10-301-0/+6
|
* gh-110968: Py_MOD_PER_INTERPRETER_GIL_SUPPORTED new in 3.13. (#110969)Victor Stinner2023-10-171-1/+2
| | | | | | | | | | * Only add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED to limited C API version 3.13. * errno, xxlimited and _ctypes_test extensions now need the limited C API version 3.13 to get Py_MOD_PER_INTERPRETER_GIL_SUPPORTED. They now include standard header files explicitly: <errno.h>, <string.h> and <stdio.h>. * xxlimited_35: Remove Py_mod_multiple_interpreters slot, incompatible with limited C API version 3.5.
* gh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)Eric Snow2023-05-051-0/+1
| | | Here we are doing no more than adding the value for Py_mod_multiple_interpreters and using it for stdlib modules. We will start checking for it in gh-104206 (once PyInterpreterState.ceval.own_gil is added in gh-104204).
* gh-99300: Use Py_NewRef() in Modules/ directory (#99473)Victor Stinner2022-11-141-8/+4
| | | | Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in test C files of the Modules/ directory.
* gh-95324: Emit a warning if an object doesn't call PyObject_GC_UnTrack ↵Pablo Galindo Salgado2022-07-271-0/+1
| | | | during deallocation in debug mode (#95325)
* gh-91320: Use _PyCFunction_CAST() (#92251)Victor Stinner2022-05-031-1/+1
| | | | | | | | | | Replace "(PyCFunction)(void(*)(void))func" cast with _PyCFunction_CAST(func). Change generated by the command: sed -i -e \ 's!(PyCFunction)(void(\*)(void)) *\([A-Za-z0-9_]\+\)!_PyCFunction_CAST(\1)!g' \ $(find -name "*.c")
* gh-89653: PEP 670: Functions don't cast pointers (#91697)Victor Stinner2022-04-251-4/+6
| | | | | | | | | | | | | | | | | | | | | In the limited C API version 3.11 and newer, the following functions no longer cast their object pointer argument with _PyObject_CAST() or _PyObject_CAST_CONST(): * Py_REFCNT(), Py_TYPE(), Py_SIZE() * Py_SET_REFCNT(), Py_SET_TYPE(), Py_SET_SIZE() * Py_IS_TYPE() * Py_INCREF(), Py_DECREF() * Py_XINCREF(), Py_XDECREF() * Py_NewRef(), Py_XNewRef() * PyObject_TypeCheck() * PyType_Check() * PyType_CheckExact() Split Py_DECREF() implementation in 3 versions to make the code more readable. Update the xxlimited.c extension, which uses the limited C API version 3.11, to pass PyObject* to these functions.
* bpo-45459: Add Py_buffer to limited API (GH-29991)Christian Heimes2022-02-021-1/+51
| | | | | | | | | | | - [x] ``Py_buffer`` struct - [x] ``PyBuffer_*()`` API functions - [x] ``PyBUF_*`` constants - [x] ``Py_bf_getbuffer`` and ``Py_bf_releasebuffer`` type slots - [x] ``PyMemoryView_FromBuffer()`` API - [x] tests for limited API - [x] ``make regen-limited-abi`` - [x] documentation update - [ ] export ``PyPickleBuffer*()`` API ???
* bpo-45434: Only exclude <stdlib.h> in Python 3.11 limited C API (GH-29027)Victor Stinner2021-10-191-2/+1
| | | | | | | The Python 3.11 limited C API no longer includes stdlib.h, stdio.h, string.h and errno.h. * Exclude Py_MEMCPY() from Python 3.11 limited C API. * xxlimited C extension is now built with Python 3.11 limited C API.
* bpo-42972: Fully implement GC protocol for xxlimited (GH-26451)Hai Shi2021-05-311-0/+8
|
* bpo-41111: xxlimited.c defines Py_LIMITED_API (GH-25151)Victor Stinner2021-04-021-0/+2
| | | | | | xxlimited.c and xxlimited_35.c now define the Py_LIMITED_API macro, rather than having to do it in the build recipe. Co-authored-by: Hai Shi <shihai1992@gmail.com>
* bpo-42111: Make the xxlimited module an example of best extension module ↵Petr Viktorin2020-12-081-155/+224
| | | | | | | practices (GH-23226) - Copy existing xxlimited to xxlimited53 (named for the limited API version it uses) - Build both modules, both in debug and release - Test both modules
* bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for ↵Pablo Galindo2020-05-271-0/+1
| | | | | | | | | PyType_FromSpec types (reverts GH-19414) (GH-20264) Heap types now always visit the type in tp_traverse. See added docs for details. This reverts commit 0169d3003be3d072751dd14a5c84748ab63a249f. Automerge-Triggered-By: @encukou
* bpo-39573: Clean up modules and headers to use Py_IS_TYPE() function (GH-18521)Dong-hee Na2020-02-171-1/+1
|
* bpo-32388: Remove cross-version binary compatibility requirement in tp_flags ↵Antoine Pitrou2019-05-291-1/+1
| | | | | | | | (GH-4944) It is now allowed to add new fields at the end of the PyTypeObject struct without having to allocate a dedicated compatibility flag in tp_flags. This will reduce the risk of running out of bits in the 32-bit tp_flags value.
* bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)Serhiy Storchaka2019-02-251-2/+5
|
* bpo-33644: Fix signatures of tp_finalize handlers in testing code. (GH-7111)Serhiy Storchaka2018-05-261-2/+1
|
* merge 3.5 (#29398)Benjamin Peterson2017-02-011-1/+1
|\
| * gc types needs to be allocated as such (closes #29398)Benjamin Peterson2017-02-011-1/+1
| |
* | Issue #25923: Added more const qualifiers to signatures of static and ↵Serhiy Storchaka2015-12-251-1/+1
|/ | | | private functions.
* Issue #24373: Eliminate PEP 489 test refleaksNick Coghlan2015-06-041-6/+20
| | | | | | | _testmultiphase and xxlimited now use tp_traverse and tp_finalize to avoid reference leaks encountered when combining tp_dealloc with PyType_FromSpec (see issue #16690 for details)
* PEP 489: Multi-phase extension module initializationNick Coghlan2015-05-231-25/+30
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Removed unintentional trailing spaces in non-external and non-generated C files.Serhiy Storchaka2015-03-181-1/+1
|
* Issue #17162: Add PyType_GetSlot.Martin v. Löwis2014-02-041-1/+1
|
* Replace Py_NotImplemented returns with the macro form Py_RETURN_NOTIMPLEMENTED.Brian Curtin2011-08-111-2/+1
| | | | The macro was introduced in #12724.
* Issue #11135: Remove redundant doc field from PyType_Spec.Martin v. Löwis2011-02-111-6/+4
| | | | Reviewed by Georg Brandl.
* Issue #11067: Add PyType_GetFlags, to support PyUnicode_CheckMartin v. Löwis2011-02-051-1/+7
| | | | in the limited ABI
* Merge branches/pep-0384.Martin v. Löwis2010-12-031-0/+283