[Python-checkins] cpython (3.4): Issue #23785: Fixed memory leak in TextIOWrapper.tell() in rare circumstances.

serhiy.storchaka python-checkins at python.org
Mon Mar 30 09:01:48 CEST 2015


https://hg.python.org/cpython/rev/442ebebad516
changeset:   95282:442ebebad516
branch:      3.4
parent:      95279:74d766d819a6
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Mon Mar 30 09:58:41 2015 +0300
summary:
  Issue #23785: Fixed memory leak in TextIOWrapper.tell() in rare circumstances.

files:
  Modules/_io/textio.c |  8 ++------
  1 files changed, 2 insertions(+), 6 deletions(-)


diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -2435,14 +2435,10 @@
     if (saved_state) {
         PyObject *type, *value, *traceback;
         PyErr_Fetch(&type, &value, &traceback);
-
         res = _PyObject_CallMethodId(self->decoder, &PyId_setstate, "(O)", saved_state);
+        _PyErr_ChainExceptions(type, value, traceback);
         Py_DECREF(saved_state);
-        if (res == NULL)
-            return NULL;
-        Py_DECREF(res);
-
-        PyErr_Restore(type, value, traceback);
+        Py_XDECREF(res);
     }
     return NULL;
 }

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list