[Python-checkins] cpython: Issue #19437: Fix _io._IOBase.close(), handle _PyObject_SetAttrId() failure
victor.stinner
python-checkins at python.org
Fri Nov 8 01:02:32 CET 2013
http://hg.python.org/cpython/rev/f88c6417b9f6
changeset: 87002:f88c6417b9f6
user: Victor Stinner <victor.stinner at gmail.com>
date: Fri Nov 08 00:29:41 2013 +0100
summary:
Issue #19437: Fix _io._IOBase.close(), handle _PyObject_SetAttrId() failure
files:
Modules/_io/iobase.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -186,11 +186,16 @@
Py_RETURN_NONE;
res = PyObject_CallMethodObjArgs(self, _PyIO_str_flush, NULL);
- _PyObject_SetAttrId(self, &PyId___IOBase_closed, Py_True);
- if (res == NULL) {
+
+ if (_PyObject_SetAttrId(self, &PyId___IOBase_closed, Py_True) < 0) {
+ Py_XDECREF(res);
return NULL;
}
- Py_XDECREF(res);
+
+ if (res == NULL)
+ return NULL;
+
+ Py_DECREF(res);
Py_RETURN_NONE;
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list