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:38:51 +02:00
parent c377fe2b96
commit 59c900d3bf
3 changed files with 6 additions and 3 deletions

View File

@ -100,7 +100,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

@ -12,6 +12,9 @@ What's New in Python 3.3.3 release candidate 1?
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 #19014: memoryview.cast() is now allowed on zero-length views. - Issue #19014: memoryview.cast() is now allowed on zero-length views.
- Issue #19098: Prevent overflow in the compiler when the recursion limit is set - Issue #19098: Prevent overflow in the compiler when the recursion limit is set

View File

@ -2083,7 +2083,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
} }
else { else {
x = PyObject_GetItem(v, w); x = PyObject_GetItem(v, w);
if (x == NULL && PyErr_Occurred()) { if (x == NULL && _PyErr_OCCURRED()) {
if (!PyErr_ExceptionMatches( if (!PyErr_ExceptionMatches(
PyExc_KeyError)) PyExc_KeyError))
break; break;
@ -2127,7 +2127,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
(PyDictObject *)f->f_builtins, (PyDictObject *)f->f_builtins,
w); w);
if (x == NULL) { if (x == NULL) {
if (!PyErr_Occurred()) if (!_PyErr_OCCURRED())
format_exc_check_arg(PyExc_NameError, format_exc_check_arg(PyExc_NameError,
GLOBAL_NAME_ERROR_MSG, w); GLOBAL_NAME_ERROR_MSG, w);
break; break;