diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-30 06:48:42 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-30 06:48:42 (GMT) |
commit | aa64c46ac9ff168d7730182d48665b0b51b4f69d (patch) | |
tree | fce292f7bbe0c540de322ec06e96ba0115221f9b /Modules/_io/bufferedio.c | |
parent | d06c201e5bf74dd1ff227ab7bea73c8c790d234b (diff) | |
download | cpython-aa64c46ac9ff168d7730182d48665b0b51b4f69d.zip cpython-aa64c46ac9ff168d7730182d48665b0b51b4f69d.tar.gz cpython-aa64c46ac9ff168d7730182d48665b0b51b4f69d.tar.bz2 |
Issue #23781: Add private helper function _PyErr_ReplaceException() that
corresponds _PyErr_ChainExceptions() in Python 3 to help porting patches
from Python 3.
Diffstat (limited to 'Modules/_io/bufferedio.c')
-rw-r--r-- | Modules/_io/bufferedio.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index f146958..b4632ed 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -483,15 +483,8 @@ buffered_close(buffered *self, PyObject *args) res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_close, NULL); if (exc != NULL) { - if (res != NULL) { - Py_CLEAR(res); - PyErr_Restore(exc, val, tb); - } - else { - Py_DECREF(exc); - Py_XDECREF(val); - Py_XDECREF(tb); - } + _PyErr_ReplaceException(exc, val, tb); + Py_CLEAR(res); } end: |