This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients BTaskaya, WildCard65, ZackerySpytz, corona10, erlendaasland, hroncok, kj, nascheme, pablogsal, ronaldoussoren, serhiy.storchaka, shihai1991, steve.dower, vstinner
Date 2021-09-08.16:32:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1631118735.88.0.532274653046.issue39573@roundup.psfhosted.org>
In-reply-to
Content
I changed the issue title to restrict its scope: "[C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type".

Making PyObject and PyVarObject structures opaque is a broader topic which should be splited into sub-issues.

"Py_TYPE(obj)=type;" is now disallowed. I consider that the work of this issue is now completed and I close the issue.

Thanks everyone who help to fix these tedious issues!

You can continue to use this issue if you need my help to adapt your C extensions to Py_SET_TYPE()/Py_SET_SIZE().

See also the upgrade_pythoncapi.py script of the pythoncapi_compat project which helps to port your C extensions without losing support for old Python versions:
https://github.com/pythoncapi/pythoncapi_compat

See also the Py_TYPE() change announcement on the capi-sig list:
https://mail.python.org/archives/list/capi-sig@python.org/thread/WGRLTHTHC32DQTACPPX36TPR2GLJAFRB/
History
Date User Action Args
2021-09-08 16:32:16vstinnersetrecipients: + vstinner, nascheme, ronaldoussoren, serhiy.storchaka, steve.dower, hroncok, corona10, ZackerySpytz, pablogsal, WildCard65, BTaskaya, shihai1991, erlendaasland, kj
2021-09-08 16:32:15vstinnersetmessageid: <1631118735.88.0.532274653046.issue39573@roundup.psfhosted.org>
2021-09-08 16:32:15vstinnerlinkissue39573 messages
2021-09-08 16:32:15vstinnercreate