mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Always test for an error return (usually NULL or -1) without setting
an exception.
This commit is contained in:
parent
d3eb5774ad
commit
eb894ebd0a
1 changed files with 4 additions and 3 deletions
|
@ -1723,6 +1723,7 @@ eval_code2(co, globals, locals,
|
||||||
if (why == WHY_NOT) {
|
if (why == WHY_NOT) {
|
||||||
if (err == 0 && x != NULL) {
|
if (err == 0 && x != NULL) {
|
||||||
#ifdef CHECKEXC
|
#ifdef CHECKEXC
|
||||||
|
/* This check is expensive! */
|
||||||
if (PyErr_Occurred())
|
if (PyErr_Occurred())
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"XXX undetected error\n");
|
"XXX undetected error\n");
|
||||||
|
@ -1735,18 +1736,18 @@ eval_code2(co, globals, locals,
|
||||||
err = 0;
|
err = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CHECKEXC
|
|
||||||
/* Double-check exception status */
|
/* Double-check exception status */
|
||||||
|
|
||||||
if (why == WHY_EXCEPTION || why == WHY_RERAISE) {
|
if (why == WHY_EXCEPTION || why == WHY_RERAISE) {
|
||||||
if (!PyErr_Occurred()) {
|
if (!PyErr_Occurred()) {
|
||||||
fprintf(stderr, "XXX ghost error\n");
|
|
||||||
PyErr_SetString(PyExc_SystemError,
|
PyErr_SetString(PyExc_SystemError,
|
||||||
"ghost error");
|
"error return without exception set");
|
||||||
why = WHY_EXCEPTION;
|
why = WHY_EXCEPTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef CHECKEXC
|
||||||
else {
|
else {
|
||||||
|
/* This check is expensive! */
|
||||||
if (PyErr_Occurred()) {
|
if (PyErr_Occurred()) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"XXX undetected error (why=%d)\n",
|
"XXX undetected error (why=%d)\n",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue