]> granicus.if.org Git - python/commitdiff
must use _PyThreadState_Current so it isn't checked for NULL #6530
authorBenjamin Peterson <benjamin@python.org>
Tue, 21 Jul 2009 14:08:40 +0000 (14:08 +0000)
committerBenjamin Peterson <benjamin@python.org>
Tue, 21 Jul 2009 14:08:40 +0000 (14:08 +0000)
Objects/dictobject.c

index d797173863f2a0ea84a5d619ecb8cad6032cf81b..c4f93d4b06d48202e5af75199e0fbd0f689c7753 100644 (file)
@@ -712,10 +712,12 @@ PyDict_GetItem(PyObject *op, PyObject *key)
                }
        }
 
-       /* We can arrive here with a NULL tstate during initialization:
-          try running "python -Wi" for an example related to string
-          interning.  Let's just hope that no exception occurs then... */
-       tstate = PyThreadState_GET();
+       /* We can arrive here with a NULL tstate during initialization: try
+          running "python -Wi" for an example related to string interning.
+          Let's just hope that no exception occurs then...  This must be
+          _PyThreadState_Current and not PyThreadState_GET() because in debug
+          mode, it complains if tstate is NULL. */
+       tstate = _PyThreadState_Current;
        if (tstate != NULL && tstate->curexc_type != NULL) {
                /* preserve the existing exception */
                PyObject *err_type, *err_value, *err_tb;