comparison Python/sysmodule.c @ 11374:66216f32403d legacy-trunk

In PySys_GetObject(), it's possible that tstate->interp->sysdict is NULL. In that case, return NULL rather than dumping core. This fixes PR#91, submitted by Lele Gaifax.
author Guido van Rossum <guido@python.org>
date Tue, 05 Oct 1999 22:17:41 +0000
parents d44cb87e500d
children dc65c5f6ad7c
comparison
equal deleted inserted replaced
11373:7e05a7d0b511 11374:66216f32403d
62 PySys_GetObject(name) 62 PySys_GetObject(name)
63 char *name; 63 char *name;
64 { 64 {
65 PyThreadState *tstate = PyThreadState_Get(); 65 PyThreadState *tstate = PyThreadState_Get();
66 PyObject *sd = tstate->interp->sysdict; 66 PyObject *sd = tstate->interp->sysdict;
67 if (sd == NULL)
68 return NULL;
67 return PyDict_GetItemString(sd, name); 69 return PyDict_GetItemString(sd, name);
68 } 70 }
69 71
70 FILE * 72 FILE *
71 PySys_GetFile(name, def) 73 PySys_GetFile(name, def)