cpython: 9af21752ea2a (original) (raw)

Mercurial > cpython

changeset 92881:9af21752ea2a 3.4

Issue #21715: Extracted shared complicated code in the _io module to new _PyErr_ChainExceptions() function. [#21715]

Serhiy Storchaka storchaka@gmail.com
date Wed, 08 Oct 2014 22:31:52 +0300
parents 5433ef907e4f
children 8b1ac1a3d007 f0e06514d67f
files Include/pyerrors.h Modules/_io/_iomodule.c Modules/_io/bufferedio.c Modules/_io/textio.c Python/errors.c
diffstat 5 files changed, 33 insertions(+), 42 deletions(-)[+] [-] Include/pyerrors.h 4 Modules/_io/_iomodule.c 15 Modules/_io/bufferedio.c 16 Modules/_io/textio.c 16 Python/errors.c 24

line wrap: on

line diff

--- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -123,7 +123,9 @@ PyAPI_FUNC(void) PyException_SetCause(Py /* Context manipulation (PEP 3134) */ PyAPI_FUNC(PyObject *) PyException_GetContext(PyObject *); PyAPI_FUNC(void) PyException_SetContext(PyObject *, PyObject *); - +#ifndef Py_LIMITED_API +PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject ); +#endif / */

--- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -468,19 +468,8 @@ io_open(PyObject *self, PyObject *args, PyObject *exc, *val, *tb, *close_result; PyErr_Fetch(&exc, &val, &tb); close_result = _PyObject_CallMethodId(result, &PyId_close, NULL);

--- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -543,20 +543,8 @@ buffered_close(buffered *self, PyObject } if (exc != NULL) {

--- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -2608,20 +2608,8 @@ textiowrapper_close(textio *self, PyObje res = _PyObject_CallMethodId(self->buffer, &PyId_close, NULL); if (exc != NULL) {

--- a/Python/errors.c +++ b/Python/errors.c @@ -384,6 +384,30 @@ PyErr_SetExcInfo(PyObject p_type, PyObj Py_XDECREF(oldtraceback); } +/ Like PyErr_Restore(), but if an exception is already set,

+

+} + /* Convenience functions to set a type error exception and return 0 */ int