[issue10156] Initialization of globals in unicodeobject.c
Stefan Krah
report at bugs.python.org
Wed Jan 9 23:54:13 CET 2013
Stefan Krah added the comment:
Nick, I'm adding you to the nosy list since this issue seems related to PEP 432.
Quick summary: Globals are used in unicodeobject.c before they are initialized.
Also, Unicode objects are created before PyType_Ready(&PyUnicode_Type) has been
called.
This happens during startup:
_Py_InitializeEx_Private():
_Py_ReadyTypes():
PyType_Ready(&PyType_Type);
[...]
Many Unicode objects like "" or "__add__" are created. Uninitialized
globals have led to a crash (#16143). This is fixed by Serhiy's patch,
which always dynamically checks all globals for NULL before using them.
However, Unicode objects are still created at this point.
[...]
PyType_Ready(&PyUnicode_Type); /* Called for the first time */
[...]
_PyUnicode_Init:
for (i = 0; i < 256; i++) /* Could leak if latin1 strings
unicode_latin1[i] = NULL; have already been created. */
PyType_Ready(&PyUnicode_Type); /* Called a second time! */
So, considering PEP 432: Are these "pre-type-ready" Unicode objects
safe to use, or should something be done about it?
----------
nosy: +ncoghlan
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10156>
_______________________________________
More information about the Python-bugs-list
mailing list