Mercurial > cpython-lru_cache-weakref
diff Objects/object.c @ 70326:d70533533f77 2.7
must clear an AttributeError if it is set
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Mon, 23 May 2011 18:17:55 -0500 |
| parents | 90399e508ce3 |
| children | a0f43f4481e0 |
line wrap: on
line diff
--- a/Objects/object.c Mon May 23 17:11:21 2011 -0500 +++ b/Objects/object.c Mon May 23 18:17:55 2011 -0500 @@ -1911,8 +1911,12 @@ assert(obj); if (PyInstance_Check(obj)) { dirfunc = PyObject_GetAttrString(obj, "__dir__"); - if (dirfunc == NULL && !PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; + if (dirfunc == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) + PyErr_Clear(); + else + return NULL; + } } else { dirfunc = _PyObject_LookupSpecial(obj, "__dir__", &dir_str);
