Skip to content

Conversation

@vstinner
Copy link
Member

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.

@vstinner
Copy link
Member Author

@erlend-aasland: I'm not sure about this change, so I created a draft PR. It's a part of the PEP 670 implementation.

@vstinner
Copy link
Member Author

See also #91768

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.
@vstinner vstinner marked this pull request as ready for review April 21, 2022 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants