""")
rc, out, err = assert_python_failure('-c', code)
self.assertRegex(err.replace(b'\r', b''),
- br'Fatal Python error: '
- br'Function result is invalid\n'
+ br'Fatal Python error: a function returned NULL '
+ br'without setting an error\n'
br'SystemError: <built-in function '
br'return_null_without_error> returned NULL '
br'without setting an error\n'
""")
rc, out, err = assert_python_failure('-c', code)
self.assertRegex(err.replace(b'\r', b''),
- br'Fatal Python error: '
- br'Function result is invalid\n'
+ br'Fatal Python error: a function returned a '
+ br'result with an error set\n'
br'ValueError\n'
br'\n'
br'During handling of the above exception, '
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 {
"%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 *