diff options
author | Guido van Rossum <guido@python.org> | 2002-06-03 19:52:41 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-06-03 19:52:41 (GMT) |
commit | b65c65b301203b2acb0b8e1b2f45d8b5079ce5fd (patch) | |
tree | da810d20fca1a7ae416447213e0f4b4656c66870 /Objects | |
parent | 155a34d2e5d755c47ae9d4de8d6dfd4eae200e46 (diff) | |
download | cpython-b65c65b301203b2acb0b8e1b2f45d8b5079ce5fd.zip cpython-b65c65b301203b2acb0b8e1b2f45d8b5079ce5fd.tar.gz cpython-b65c65b301203b2acb0b8e1b2f45d8b5079ce5fd.tar.bz2 |
Address the residual issue with the fix for SF 551412 in
_PyType_Lookup(). Decided to clear the error condition in the
unfortunate but unlikely case that PyType_Ready() fails.
Will fix in 2.2.x too.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index af133ea..dd6f1b5 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1222,8 +1222,18 @@ _PyType_Lookup(PyTypeObject *type, PyObject *name) /* Look in tp_dict of types in MRO */ mro = type->tp_mro; if (mro == NULL) { - if (PyType_Ready(type) < 0) + if (PyType_Ready(type) < 0) { + /* It's not ideal to clear the error condition, + but this function is documented as not setting + an exception, and I don't want to change that. + When PyType_Ready() can't proceed, it won't + set the "ready" flag, so future attempts to ready + the same type will call it again -- hopefully + in a context that propagates the exception out. + */ + PyErr_Clear(); return NULL; + } mro = type->tp_mro; assert(mro != NULL); } |