[issue31791] Ensure that all PyTypeObject fields are set to non-NULL defaults

Serhiy Storchaka report at bugs.python.org
Sun Oct 15 02:59:30 EDT 2017


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

1. This will increase the size of type object. Most types are not numbers, not collections and don't support the buffer protocol, thus save memory for tp_as_number, tp_as_sequence, tp_as_mapping and tp_as_buffer. This also can increase the time of type creation.

2. This will make harder testing that the particular protocol is supported (e.g. see PyIndex_Check or PyObject_CheckBuffer). And this will break any third-party code that does this directly, without using C API.

3. Calling function instead of executing inlined code after checking can increase stack consumption and slow down execution (see the usage of tp_descr_get).

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31791>
_______________________________________


More information about the Python-bugs-list mailing list