[issue10156] Initialization of globals in unicodeobject.c

Stefan Krah report at bugs.python.org
Thu Jan 10 01:21:25 CET 2013


Stefan Krah added the comment:

Nick Coghlan <report at bugs.python.org> wrote:
> There should still be a check in tp_new (IIRC) that calls PyType_Ready on
> unready types.

Indeed there is one in type_new(), but that isn't used here AFAICS. If
you apply this patch and start up python, there are many "str: not ready"
instances:

diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -14282,6 +14282,10 @@
 PyUnicode_InternFromString(const char *cp)
 {
     PyObject *s = PyUnicode_FromString(cp);
+
+    fprintf(stderr, "%s: %s\n", PyUnicode_Type.tp_name,
+       (PyUnicode_Type.tp_flags & Py_TPFLAGS_READY) ? "ready" : "not ready");
+
     if (s == NULL)
         return NULL;
     PyUnicode_InternInPlace(&s);

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10156>
_______________________________________


More information about the Python-bugs-list mailing list