New submission from Eddie Elizondo <eduardo.elizondoru...@gmail.com>:

>From the documentation, it says that PyType_Ready should be called on `ALL` 
>type objects to finish their initialization 
>(https://docs.python.org/3/c-api/type.html#c.PyType_Ready). This means that a 
>PyTypeObject's ob_type should always be set by PyType_Ready.

It turns out that this is not actually followed by all the core types in 
CPython. This leads to the usage of types that were not initialized through 
PyType_Ready.

This fix modifies PyVarObject_HEAD_INIT to default the type to NULL so that all 
objects have to be fully initialized through PyType_Ready.

Plus:
* It initializes all the objects that were not being initialized through 
PyType_Ready.
* Modifies PyType_Ready to special case the ob_type initialization of 
PyType_Type and PyBaseObject_Type.
* It modifies the edge case of _Py_FalseStruct and _Py_TrueStruct.

Read more: https://mail.python.org/pipermail/python-dev/2018-August/154946.html

----------
components: Interpreter Core
messages: 324195
nosy: eelizondo
priority: normal
severity: normal
status: open
title: PyTypeObject's tp_base initialization bug
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34522>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to