-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stable ABI doesn't work with PySide (Shiboken) on Python 3.12 #118997
Comments
vstinner
added a commit
to vstinner/cpython
that referenced
this issue
May 13, 2024
Fix _Py_ClearImmortal() assertion: use _Py_IsImmortal() to tolerate reference count lower than _Py_IMMORTAL_REFCNT. Fix the assertion for the stable ABI, when a C extension is built with Python 3.11 or lower.
Does this not happen on 3.13+ as well? |
3.13 uses |
vstinner
added a commit
that referenced
this issue
May 18, 2024
Thanks for fixing this, @vstinner. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
PEP 683 "Immortal Objects, Using a Fixed Refcount" announces that the stable ABI is not affected: https://peps.python.org/pep-0683/#stable-abi
Well, in practice, it is affected. Shiboken used by PySide runs the following code at startup:
PyObject_GetAttrString()
leavesPyType_Type.tp_bases.ob_refcnt
unchanged since it's an immortal tuple, and the code runs on Python 3.12 which is aware of immortal object.Py_DECREF(bases)
decrementsPyType_Type.tp_bases.ob_refcnt
since the code is built with Python 3.9 andPy_DECREF()
is inlined.The problem occurs at Python exit, when static types are cleared by
_PyStaticType_Dealloc()
. The following code is executed:with:
The condition
assert(op->ob_refcnt == _Py_IMMORTAL_REFCNT);
is false.IMO
_Py_ClearImmortal()
should use _Py_IsImmortal() in the assertion instead, asclear_tp_bases()
does.Fedora downstream issue: https://bugzilla.redhat.com/show_bug.cgi?id=2279088
Linked PRs
The text was updated successfully, but these errors were encountered: