New submission from STINNER Victor <vstin...@python.org>:

Currently, PyType_Ready() is called late on many static types, which can lead 
to bugs. For example, PyObject_SetAttr() can fail if the type of the object is 
not ready yet. PyType_Read() is responsible to initialize tp_getattro and 
tp_setattro members of the PyTypeObject structure.

We must explicitly initialize all static types before using them.

Moreover, many static types initialize explicitly :

  tp_getattro = PyObject_GenericGetAttr

and:

  tp_setattro = PyObject_GenericSetAttr

whereas it's the default implementation. They can be omitted.

I created this issue as a placeholder for multiple changes to modify how types 
implemented in C are initialized.

----------
components: Interpreter Core
messages: 390484
nosy: vstinner
priority: normal
severity: normal
status: open
title: Rework C types initialization
versions: Python 3.10

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

Reply via email to