]> granicus.if.org Git - python/commitdiff
merge 3.3 (#16597)
authorBenjamin Peterson <benjamin@python.org>
Thu, 20 Dec 2012 17:55:16 +0000 (11:55 -0600)
committerBenjamin Peterson <benjamin@python.org>
Thu, 20 Dec 2012 17:55:16 +0000 (11:55 -0600)
1  2 
Lib/_pyio.py
Lib/test/test_io.py
Misc/NEWS
Modules/_io/bufferedio.c
Modules/_io/textio.c

diff --cc Lib/_pyio.py
Simple merge
Simple merge
diff --cc Misc/NEWS
Simple merge
index 432349a7f6370c55f897576d90610932f4a47f59,b077f34fff8c49d63031292964880d6fede7a426..ea32a5e17352252f89d1358cb51f7c5487a68c28
@@@ -519,11 -519,22 +519,27 @@@ buffered_close(buffered *self, PyObjec
  
      res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_close, NULL);
  
 +    if (self->buffer) {
 +        PyMem_Free(self->buffer);
 +        self->buffer = NULL;
 +    }
 +
+     if (exc != NULL) {
+         if (res != NULL) {
+             Py_CLEAR(res);
+             PyErr_Restore(exc, val, tb);
+         }
+         else {
+             PyObject *val2;
+             Py_DECREF(exc);
+             Py_XDECREF(tb);
+             PyErr_Fetch(&exc, &val2, &tb);
+             PyErr_NormalizeException(&exc, &val2, &tb);
+             PyException_SetContext(val2, val);
+             PyErr_Restore(exc, val2, tb);
+         }
+     }
  end:
      LEAVE_BUFFERED(self)
      return res;
Simple merge