]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-115754: Add Py_GetConstant() function (#116883)
authorVictor Stinner <vstinner@python.org>
Thu, 21 Mar 2024 16:07:00 +0000 (17:07 +0100)
committerGitHub <noreply@github.com>
Thu, 21 Mar 2024 16:07:00 +0000 (16:07 +0000)
commit8bea6c411d65cd987616b4ecdb86373e4f21f1c6
tree962f984417dab800fbf4d21048a1fd8ba39202f0
parent5a76d1be8ef371b75ca65166726923c249b5f615
gh-115754: Add Py_GetConstant() function (#116883)

Add Py_GetConstant() and Py_GetConstantBorrowed() functions.

In the limited C API version 3.13, getting Py_None, Py_False,
Py_True, Py_Ellipsis and Py_NotImplemented singletons is now
implemented as function calls at the stable ABI level to hide
implementation details. Getting these constants still return borrowed
references.

Add _testlimitedcapi/object.c and test_capi/test_object.py to test
Py_GetConstant() and Py_GetConstantBorrowed() functions.
22 files changed:
Doc/c-api/object.rst
Doc/data/stable_abi.dat
Doc/whatsnew/3.13.rst
Include/boolobject.h
Include/internal/pycore_object.h
Include/object.h
Include/sliceobject.h
Lib/test/test_capi/test_object.py [new file with mode: 0644]
Lib/test/test_stable_abi_ctypes.py
Misc/NEWS.d/next/C API/2024-03-15-23-55-24.gh-issue-115754.xnzc__.rst [new file with mode: 0644]
Misc/NEWS.d/next/C API/2024-03-15-23-57-33.gh-issue-115754.zLdv82.rst [new file with mode: 0644]
Misc/stable_abi.toml
Modules/Setup.stdlib.in
Modules/_testlimitedcapi.c
Modules/_testlimitedcapi/object.c [new file with mode: 0644]
Modules/_testlimitedcapi/parts.h
Objects/object.c
PC/python3dll.c
PCbuild/_testlimitedcapi.vcxproj
PCbuild/_testlimitedcapi.vcxproj.filters
Python/pylifecycle.c
Tools/c-analyzer/cpython/ignored.tsv