mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
bpo-32571: Avoid raising unneeded AttributeError and silencing it in C code (GH-5222)
Add two new private APIs: _PyObject_LookupAttr() and _PyObject_LookupAttrId()
This commit is contained in:
parent
2b822a0bb1
commit
f320be77ff
22 changed files with 1455 additions and 1442 deletions
|
|
@ -1541,7 +1541,9 @@ _bufferedreader_read_all(buffered *self)
|
|||
}
|
||||
_bufferedreader_reset_buf(self);
|
||||
|
||||
readall = _PyObject_GetAttrWithoutError(self->raw, _PyIO_str_readall);
|
||||
if (_PyObject_LookupAttr(self->raw, _PyIO_str_readall, &readall) < 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
if (readall) {
|
||||
tmp = _PyObject_CallNoArg(readall);
|
||||
Py_DECREF(readall);
|
||||
|
|
@ -1561,9 +1563,6 @@ _bufferedreader_read_all(buffered *self)
|
|||
}
|
||||
goto cleanup;
|
||||
}
|
||||
else if (PyErr_Occurred()) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
chunks = PyList_New(0);
|
||||
if (chunks == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue