summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-09-01 11:01:05 (GMT)
committerGitHub <noreply@github.com>2019-09-01 11:01:05 (GMT)
commit353053d9ad08fea0e205e6c008b8a4350c0188e6 (patch)
tree3bd4434c152e934fb260c1c1651c080c3df29a14 /Objects/setobject.c
parent6922b9e4fce635339cb94c2fdef6bba4e2a99621 (diff)
downloadcpython-353053d9ad08fea0e205e6c008b8a4350c0188e6.zip
cpython-353053d9ad08fea0e205e6c008b8a4350c0188e6.tar.gz
cpython-353053d9ad08fea0e205e6c008b8a4350c0188e6.tar.bz2
[3.8] bpo-37994: Fix silencing all errors if an attribute lookup fails. (GH-15630) (GH-15635)
Only AttributeError should be silenced. (cherry picked from commit 41c57b335330ff48af098d47e379e0f9ba09d233)
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r--Objects/setobject.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 8cd95ba..f8ae0c0 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -1954,9 +1954,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);
}