diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-09-01 12:03:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-01 12:03:39 +0300 |
commit | 41c57b335330ff48af098d47e379e0f9ba09d233 (patch) | |
tree | 15cdef099182eddb04b2276dc51375b8faf28278 /Objects/setobject.c | |
parent | bpo-36543: Remove old-deprecated ElementTree features. (GH-12707) (diff) | |
download | cpython-41c57b335330ff48af098d47e379e0f9ba09d233.tar.gz cpython-41c57b335330ff48af098d47e379e0f9ba09d233.tar.bz2 cpython-41c57b335330ff48af098d47e379e0f9ba09d233.zip |
bpo-37994: Fix silencing all errors if an attribute lookup fails. (GH-15630)
Only AttributeError should be silenced.
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r-- | Objects/setobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index fafc2fa9e46..924885d7505 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -1970,9 +1970,10 @@ set_reduce(PySetObject *so, PyObject *Py_UNUSED(ignored)) args = PyTuple_Pack(1, keys); if (args == NULL) goto done; - dict = _PyObject_GetAttrId((PyObject *)so, &PyId___dict__); + if (_PyObject_LookupAttrId((PyObject *)so, &PyId___dict__, &dict) < 0) { + goto done; + } if (dict == NULL) { - PyErr_Clear(); dict = Py_None; Py_INCREF(dict); } |