mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #17671: Fixed a crash when use non-initialized io.BufferedRWPair.
Based on patch by Stephen Tu.
This commit is contained in:
parent
1f9d11b986
commit
61e2493b83
3 changed files with 48 additions and 2 deletions
|
@ -2263,9 +2263,14 @@ bufferedrwpair_dealloc(rwpair *self)
|
|||
static PyObject *
|
||||
_forward_call(buffered *self, _Py_Identifier *name, PyObject *args)
|
||||
{
|
||||
PyObject *func = _PyObject_GetAttrId((PyObject *)self, name);
|
||||
PyObject *ret;
|
||||
PyObject *func, *ret;
|
||||
if (self == NULL) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"I/O operation on uninitialized object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
func = _PyObject_GetAttrId((PyObject *)self, name);
|
||||
if (func == NULL) {
|
||||
PyErr_SetString(PyExc_AttributeError, name->string);
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue