Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at least one place so as to avoid regressions.

This commit is contained in:
Antoine Pitrou 2013-10-07 20:40:59 +02:00
commit 1cfa0ba883
3 changed files with 6 additions and 3 deletions

View File

@ -101,7 +101,7 @@ PyAPI_FUNC(void) Py_FatalError(const char *message) _Py_NO_RETURN;
#if defined(Py_DEBUG) || defined(Py_LIMITED_API) #if defined(Py_DEBUG) || defined(Py_LIMITED_API)
#define _PyErr_OCCURRED() PyErr_Occurred() #define _PyErr_OCCURRED() PyErr_Occurred()
#else #else
#define _PyErr_OCCURRED() (_PyThreadState_Current->curexc_type) #define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type)
#endif #endif
/* Error testing and normalization */ /* Error testing and normalization */

View File

@ -10,6 +10,9 @@ Projected release date: 2013-10-20
Core and Builtins Core and Builtins
----------------- -----------------
- Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at
least one place so as to avoid regressions.
- Issue #19087: Improve bytearray allocation in order to allow cheap popping - Issue #19087: Improve bytearray allocation in order to allow cheap popping
of data at the front (slice deletion). of data at the front (slice deletion).

View File

@ -2162,7 +2162,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
} }
else { else {
v = PyObject_GetItem(locals, name); v = PyObject_GetItem(locals, name);
if (v == NULL && PyErr_Occurred()) { if (v == NULL && _PyErr_OCCURRED()) {
if (!PyErr_ExceptionMatches(PyExc_KeyError)) if (!PyErr_ExceptionMatches(PyExc_KeyError))
goto error; goto error;
PyErr_Clear(); PyErr_Clear();
@ -2207,7 +2207,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
(PyDictObject *)f->f_builtins, (PyDictObject *)f->f_builtins,
name); name);
if (v == NULL) { if (v == NULL) {
if (!PyErr_Occurred()) if (!_PyErr_OCCURRED())
format_exc_check_arg(PyExc_NameError, format_exc_check_arg(PyExc_NameError,
NAME_ERROR_MSG, name); NAME_ERROR_MSG, name);
goto error; goto error;