Skip to content

[3.12] gh-102304: Fix Py_INCREF() stable ABI in debug mode (#104763) - #105352

Merged
vstinner merged 1 commit into
python:3.12from
vstinner:incref_debug312
Jun 6, 2023
Merged

vstinner merged 1 commit into
python:3.12from
vstinner:incref_debug312

Conversation

@vstinner

@vstinner vstinner commented Jun 6, 2023 •

Copy link
Copy Markdown
Member

When Python is built in debug mode (if the Py_REF_DEBUG macro is defined), the Py_INCREF() and Py_DECREF() function are now always implemented as opaque functions to avoid leaking implementation details like the "_Py_RefTotal" variable or the
_Py_DecRefTotal_DO_NOT_USE_THIS() function.

  • Remove _Py_IncRefTotal_DO_NOT_USE_THIS() and _Py_DecRefTotal_DO_NOT_USE_THIS() from the stable ABI.
  • Remove _Py_NegativeRefcount() from limited C API.

(cherry picked from commit 92022d8)


📚 Documentation preview 📚: https://cpython-previews--105352.org.readthedocs.build/

@vstinner

vstinner commented Jun 6, 2023

Copy link
Copy Markdown
Member Author

Oh. If this change is merged, Doc/whatsnew/3.13.rst must be updated in the main branch: the build change happens in Python 3.12, not 3.13.

@vstinner

vstinner commented Jun 6, 2023

Copy link
Copy Markdown
Member Author

PR #105347 doc change should be merged first.

)

When Python is built in debug mode (if the Py_REF_DEBUG macro is
defined), the Py_INCREF() and Py_DECREF() function are now always
implemented as opaque functions to avoid leaking implementation
details like the "_Py_RefTotal" variable or the
_Py_DecRefTotal_DO_NOT_USE_THIS() function.

* Remove _Py_IncRefTotal_DO_NOT_USE_THIS() and
  _Py_DecRefTotal_DO_NOT_USE_THIS() from the stable ABI.
* Remove _Py_NegativeRefcount() from limited C API.

(cherry picked from commit 92022d8)
@vstinner
vstinner merged commit 2bbb557 into python:3.12 Jun 6, 2023
@vstinner
vstinner deleted the incref_debug312 branch June 6, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants