mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
[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 41c57b3353
)
This commit is contained in:
parent
6922b9e4fc
commit
353053d9ad
14 changed files with 133 additions and 126 deletions
|
@ -2063,9 +2063,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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue