diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-09-01 09:03:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-01 09:03:39 (GMT) |
commit | 41c57b335330ff48af098d47e379e0f9ba09d233 (patch) | |
tree | 15cdef099182eddb04b2276dc51375b8faf28278 /Objects/bytearrayobject.c | |
parent | f02ea6225bc3b71bd5fe66224d199a6e3e23b14d (diff) | |
download | cpython-41c57b335330ff48af098d47e379e0f9ba09d233.zip cpython-41c57b335330ff48af098d47e379e0f9ba09d233.tar.gz cpython-41c57b335330ff48af098d47e379e0f9ba09d233.tar.bz2 |
bpo-37994: Fix silencing all errors if an attribute lookup fails. (GH-15630)
Only AttributeError should be silenced.
Diffstat (limited to 'Objects/bytearrayobject.c')
-rw-r--r-- | Objects/bytearrayobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 9dd6712..8c16cc6 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -2061,9 +2061,10 @@ _common_reduce(PyByteArrayObject *self, int proto) _Py_IDENTIFIER(__dict__); char *buf; - dict = _PyObject_GetAttrId((PyObject *)self, &PyId___dict__); + if (_PyObject_LookupAttrId((PyObject *)self, &PyId___dict__, &dict) < 0) { + return NULL; + } if (dict == NULL) { - PyErr_Clear(); dict = Py_None; Py_INCREF(dict); } |