Repository navigation
Conversation
…python#162120) Py_INCREF(), Py_XINCREF(), Py_DECREF() and Py_XDECREF() are now implemented as function calls on all limited C API versions. Previously, they were only implemented as function calls on the limited C API version 3.12 or newer. Previously, if a C extension was built with the limited C API version 3.11 or newer, Py_DECREF() was implemented as "op->ob_refcnt--". But Python 3.12 made Py_DECREF() more complicated to implement immortal objects in an efficient way. "op->ob_refcnt--" can convert an immortal object to a mortal object which causes various kinds of nasty bugs. Backport to 3.15: mention the change in "Notable changes in 3.15.3" of What's New in Python 3.15. Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com> Co-authored-by: Petr Viktorin <encukou@gmail.com> (cherry picked from commit d1e3cae)
|
@encukou @da-woods: I propose backporting the limited C API change to 3.14 and 3.15 changes. Here is a first change to 3.15. If this change is merged, I will then forward port the What's New in Python 3.15 change to the main branch (and same for What's New in Python 3.14). I'm not sure about backporting the change to 3.11, 3.12 and 3.13 security branches. |
Documentation build overview
173 files changed ·
|
I don't really mind either way. The next Cython releases will call I largely agree with Mark that the "real" fix is to the special-casing of the true/false checks. But I don't think it's a bad thing to compile to the opaque function calls as widely as possible. |
Py_INCREF(), Py_XINCREF(), Py_DECREF() and Py_XDECREF() are now implemented as function calls on all limited C API versions. Previously, they were only implemented as function calls on the limited C API version 3.12 or newer.
Previously, if a C extension was built with the limited C API version 3.11 or newer, Py_DECREF() was implemented as "op->ob_refcnt--". But Python 3.12 made Py_DECREF() more complicated to implement immortal objects in an efficient way. "op->ob_refcnt--" can convert an immortal object to a mortal object which causes various kinds of nasty bugs.
Backport to 3.15: mention the change in "Notable changes in 3.15.3" of What's New in Python 3.15.
(cherry picked from commit d1e3cae)