diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-04-18 20:54:08 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-04-18 20:54:08 (GMT) |
commit | ae937c021dfd3a2898c85212782457740c7ab6ab (patch) | |
tree | 6a081251f0deaa68818924a8e5f9069a1c55cbaa /Objects | |
parent | 332424777f4bf213b1db1b7dcfa592d2fe5ae772 (diff) | |
download | cpython-ae937c021dfd3a2898c85212782457740c7ab6ab.zip cpython-ae937c021dfd3a2898c85212782457740c7ab6ab.tar.gz cpython-ae937c021dfd3a2898c85212782457740c7ab6ab.tar.bz2 |
Merged revisions 71722 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r71722 | benjamin.peterson | 2009-04-18 15:12:47 -0500 (Sat, 18 Apr 2009) | 1 line
try to initalize all builtin types with PyType_Ready to avoid problems like #5787
........
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/frameobject.c | 4 | ||||
-rw-r--r-- | Objects/object.c | 68 |
2 files changed, 64 insertions, 8 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 52898cc..e29c647 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -577,7 +577,9 @@ static PyObject *builtin_object; int _PyFrame_Init() { builtin_object = PyUnicode_InternFromString("__builtins__"); - return (builtin_object != NULL); + if (builtin_object == NULL) + return 0; + return 1; } PyFrameObject * diff --git a/Objects/object.c b/Objects/object.c index 14cacb3..1975f14 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -1479,31 +1479,85 @@ void _Py_ReadyTypes(void) { if (PyType_Ready(&PyType_Type) < 0) - Py_FatalError("Can't initialize 'type'"); + Py_FatalError("Can't initialize type type"); if (PyType_Ready(&_PyWeakref_RefType) < 0) - Py_FatalError("Can't initialize 'weakref'"); + Py_FatalError("Can't initialize weakref type"); if (PyType_Ready(&PyBool_Type) < 0) - Py_FatalError("Can't initialize 'bool'"); + Py_FatalError("Can't initialize bool type"); if (PyType_Ready(&PyByteArray_Type) < 0) - Py_FatalError("Can't initialize 'bytes'"); + Py_FatalError("Can't initialize bytearray"); if (PyType_Ready(&PyBytes_Type) < 0) Py_FatalError("Can't initialize 'str'"); if (PyType_Ready(&PyList_Type) < 0) - Py_FatalError("Can't initialize 'list'"); + Py_FatalError("Can't initialize list"); if (PyType_Ready(&PyNone_Type) < 0) - Py_FatalError("Can't initialize type(None)"); + Py_FatalError("Can't initialize None type"); if (PyType_Ready(Py_Ellipsis->ob_type) < 0) Py_FatalError("Can't initialize type(Ellipsis)"); if (PyType_Ready(&PyNotImplemented_Type) < 0) - Py_FatalError("Can't initialize type(NotImplemented)"); + Py_FatalError("Can't initialize NotImplemented type"); + + if (PyType_Ready(&PyTraceBack_Type) < 0) + Py_FatalError("Can't initialize traceback type"); + + if (PyType_Ready(&PySuper_Type) < 0) + Py_FatalError("Can't initialize super type"); + + if (PyType_Ready(&PyBaseObject_Type) < 0) + Py_FatalError("Can't initialize object type"); + + if (PyType_Ready(&PyRange_Type) < 0) + Py_FatalError("Can't initialize range type"); + + if (PyType_Ready(&PyDict_Type) < 0) + Py_FatalError("Can't initialize dict type"); + + if (PyType_Ready(&PySet_Type) < 0) + Py_FatalError("Can't initialize set type"); + + if (PyType_Ready(&PyUnicode_Type) < 0) + Py_FatalError("Can't initialize str type"); + + if (PyType_Ready(&PySlice_Type) < 0) + Py_FatalError("Can't initialize slice type"); + + if (PyType_Ready(&PyStaticMethod_Type) < 0) + Py_FatalError("Can't initialize static method type"); + + if (PyType_Ready(&PyComplex_Type) < 0) + Py_FatalError("Can't initialize complex type"); + + if (PyType_Ready(&PyFloat_Type) < 0) + Py_FatalError("Can't initialize float type"); + + if (PyType_Ready(&PyLong_Type) < 0) + Py_FatalError("Can't initialize int type"); + + if (PyType_Ready(&PyFrozenSet_Type) < 0) + Py_FatalError("Can't initialize frozenset type"); + + if (PyType_Ready(&PyProperty_Type) < 0) + Py_FatalError("Can't initialize property type"); + + if (PyType_Ready(&PyMemoryView_Type) < 0) + Py_FatalError("Can't initialize memoryview type"); + + if (PyType_Ready(&PyTuple_Type) < 0) + Py_FatalError("Can't initialize tuple type"); + + if (PyType_Ready(&PyEnum_Type) < 0) + Py_FatalError("Can't initialize enumerate type"); + + if (PyType_Ready(&PyReversed_Type) < 0) + Py_FatalError("Can't initialize reversed type"); if (PyType_Ready(&PyCode_Type) < 0) Py_FatalError("Can't initialize 'code'"); |