]> granicus.if.org Git - python/commitdiff
In PySys_GetObject(), it's possible that tstate->interp->sysdict is
authorGuido van Rossum <guido@python.org>
Tue, 5 Oct 1999 22:17:41 +0000 (22:17 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 5 Oct 1999 22:17:41 +0000 (22:17 +0000)
NULL.  In that case, return NULL rather than dumping core.

This fixes PR#91, submitted by Lele Gaifax.

Python/sysmodule.c

index 5a066a5997dae5e3223da9825fc34b8cfc598b5b..a7a59333ee45fb5ddb123e7aaad6f070755646b1 100644 (file)
@@ -64,6 +64,8 @@ PySys_GetObject(name)
 {
        PyThreadState *tstate = PyThreadState_Get();
        PyObject *sd = tstate->interp->sysdict;
+       if (sd == NULL)
+               return NULL;
        return PyDict_GetItemString(sd, name);
 }