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:06:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
At commit cb15afcccffc6c42cbfb7456ce8db89cd2f77512, I am able to rename PyObject members (to make sure that the structure is not accessed directly), I only had to modify header files:

* Py_TYPE(), Py_SET_TYPE()
* Py_IS_TYPE()

And just two more C files which corner cases:

* 1 line in Python/specialize.c
* 1 line in Modules/_testcapimodule.c: check_pyobject_forbidden_bytes_is_freed()


I did the same with PyVarObject, rename the ob_size member. I had to modify header files:

* Py_SIZE(), Py_SET_SIZE()

But I had to modify the following function of the array module:

static int
array_buffer_getbuf(arrayobject *self, Py_buffer *view, int flags)
    if ((flags & PyBUF_ND)==PyBUF_ND) {
        view->shape = &((PyVarObject*)self)->ob_size;
    return 0;

I'm not sure how to patch this function.


This experience doesn't check usage of sizeof(PyObject) and sizeof(PyVarObject) which would break if these structures become opaque. sizeof() issues are listed in previous comments.
Date User Action Args
2021-09-08 16:06:14vstinnersetrecipients: + vstinner, nascheme, ronaldoussoren, serhiy.storchaka, steve.dower, hroncok, corona10, ZackerySpytz, pablogsal, WildCard65, BTaskaya, shihai1991, erlendaasland, kj
2021-09-08 16:06:14vstinnersetmessageid: <>
2021-09-08 16:06:14vstinnerlinkissue39573 messages
2021-09-08 16:06:14vstinnercreate