Message401395
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_REFCNT(), Py_SET_REFCNT()
* Py_INCREF(), Py_DECREF()
* 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:14 | vstinner | set | recipients:
+ vstinner, nascheme, ronaldoussoren, serhiy.storchaka, steve.dower, hroncok, corona10, ZackerySpytz, pablogsal, WildCard65, BTaskaya, shihai1991, erlendaasland, kj |
2021-09-08 16:06:14 | vstinner | set | messageid: <1631117174.7.0.849754008645.issue39573@roundup.psfhosted.org> |
2021-09-08 16:06:14 | vstinner | link | issue39573 messages |
2021-09-08 16:06:14 | vstinner | create | |
|