fix strange errors when setting attributes on tracebacks #4034

This commit is contained in:
Benjamin Peterson 2009-03-18 20:52:15 +00:00
parent 7c33bd5ecb
commit 6ffe852f90
4 changed files with 22 additions and 23 deletions

View file

@ -604,7 +604,17 @@ static PyObject *builtin_object;
int _PyFrame_Init()
{
builtin_object = PyString_InternFromString("__builtins__");
return (builtin_object != NULL);
if (builtin_object == NULL)
return 0;
/*
Traceback objects are not created the normal way (through calling the
type), so PyType_Ready has to be called here.
*/
if (PyType_Ready(&PyTraceBack_Type)) {
Py_DECREF(builtin_object);
return 0;
}
return 1;
}
PyFrameObject *