Message401395
| 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 |
<1631117174.7.0.849754008645.issue39573@roundup.psfhosted.org> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| 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 |
|