]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-89653: PEP 670: Functions don't cast pointers (#91697)
authorVictor Stinner <vstinner@python.org>
Mon, 25 Apr 2022 22:11:34 +0000 (00:11 +0200)
committerGitHub <noreply@github.com>
Mon, 25 Apr 2022 22:11:34 +0000 (00:11 +0200)
commit61381d7da1233849b280706f11dbcae4deed949d
treea3360edc814d774a13d5170d2d86ca9279c214be
parent1cd8c29dace2dc6b91503803113fea4288ca842b
gh-89653: PEP 670: Functions don't cast pointers (#91697)

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.
Include/cpython/unicodeobject.h
Include/object.h
Modules/xxlimited.c