-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Issue with PyObject_DelAttr[String]
in stable ABI builds targeting older CPython versions
#134989
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
Comments
cc @vstinner |
Same behaviour also on Windows 11. |
This works! However, would it not be safer to also wrap the declaration of I am concerned that a user might include files in such a way that the macro rewrites the declaration. Maybe you already thought about this, and it is not possible. |
Cool. Thanks for testing!
The Python C API requires to only include |
…ed C API (pythonGH-135021) (cherry picked from commit c211130) Co-authored-by: Victor Stinner <vstinner@python.org>
…ed C API (pythonGH-135021) (cherry picked from commit c211130)
The |
Don't treat Py_None, Py_True and Py_False as immortal in the limited C API 3.11 and older.
Don't treat Py_None, Py_True and Py_False as immortal in the limited C API 3.11 and older.
Oh right, I wrote #135165 to fix these macros. |
Fix Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE macros in the limited C API 3.11 and older: don't treat Py_None, Py_True and Py_False as immortal.
Fix Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE macros in the limited C API 3.11 and older: Don't treat Py_None, Py_True and Py_False as immortal.
…#135178) gh-134989: Fix Py_RETURN_NONE in the limited C API (GH-135165) Fix Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE macros in the limited C API 3.11 and older: Don't treat Py_None, Py_True and Py_False as immortal. (cherry picked from commit 9258f3d) Co-authored-by: Victor Stinner <vstinner@python.org>
Fixed. Thanks for the report @wjakob. |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
To my knowledge, one can use newer Python version (e.g. Python 3.13) to build C extensions for older Python versions (e.g. 3.12) when targeting the stable ABI. This is accomplished by setting
Py_LIMITED_API
to a suitable number like0x030b0000
, which simply disables all features beyond this cutoff.If this understanding is correct, then I would like to report a bug:
Python 3.13 added an new C API function for
PyObject_DelAttr()
. In contrast, Python 3.12 realized this operation using a macro wrappingPyObject_SetAttr()
:This change is problematic: extensions built on 3.13 targeting 3.12 stable ABI will now call a function that does not exist on Python 3.12, and such extensions will fail to load with a linker error. The change to the new C API entry point should have been guarded with
#ifdefs
.This issue also affects
PyObject_DelAttrString()
.CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: