diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-24 15:28:52 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-24 15:28:52 (GMT) |
commit | 944fbcc478e36523add77574e172caf518647c74 (patch) | |
tree | 2aaa3be535201b0b936dc64bd878a7b4eadb0f59 /Objects | |
parent | 381a9bce9762fe2db4a7951f689df4d06ba53f79 (diff) | |
download | cpython-944fbcc478e36523add77574e172caf518647c74.zip cpython-944fbcc478e36523add77574e172caf518647c74.tar.gz cpython-944fbcc478e36523add77574e172caf518647c74.tar.bz2 |
Issue #23571: Enhance _Py_CheckFunctionResult()
Too bad, sometimes Py_FatalError() is unable to write the exception into
sys.stderr (on "AMD64 OpenIndiana 3.x" buildbot, the buildbot was probably out
of memory).
Call Py_FatalError() with a different message for the two cases (result+error,
or no result and no error).
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/abstract.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 6f8432e..dc8fb37 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2090,7 +2090,11 @@ _Py_CheckFunctionResult(PyObject *func, PyObject *result, const char *where) PyErr_Format(PyExc_SystemError, "%s returned NULL without setting an error", where); - goto error; +#ifdef Py_DEBUG + /* Ensure that the bug is catched in debug mode */ + Py_FatalError("a function returned NULL without setting an error"); +#endif + return NULL; } } else { @@ -2109,17 +2113,14 @@ _Py_CheckFunctionResult(PyObject *func, PyObject *result, const char *where) "%s returned a result with an error set", where); _PyErr_ChainExceptions(exc, val, tb); - goto error; +#ifdef Py_DEBUG + /* Ensure that the bug is catched in debug mode */ + Py_FatalError("a function returned a result with an error set"); +#endif + return NULL; } } return result; - -error: -#ifdef Py_DEBUG - /* Ensure that the bug is catched in debug mode */ - Py_FatalError("Function result is invalid"); -#endif - return NULL; } PyObject * |