From 59c900d3bf85965efe7edc1a3bb7e9b49512f6ab Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Mon, 7 Oct 2013 20:38:51 +0200 Subject: Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at least one place so as to avoid regressions. --- Include/pyerrors.h | 2 +- Misc/NEWS | 3 +++ Python/ceval.c | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Include/pyerrors.h b/Include/pyerrors.h index af37410..e385123 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -100,7 +100,7 @@ PyAPI_FUNC(void) Py_FatalError(const char *message) _Py_NO_RETURN; #if defined(Py_DEBUG) || defined(Py_LIMITED_API) #define _PyErr_OCCURRED() PyErr_Occurred() #else -#define _PyErr_OCCURRED() (_PyThreadState_Current->curexc_type) +#define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type) #endif /* Error testing and normalization */ diff --git a/Misc/NEWS b/Misc/NEWS index 5fa7695..d7d5644 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,9 @@ What's New in Python 3.3.3 release candidate 1? 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 #19098: Prevent overflow in the compiler when the recursion limit is set diff --git a/Python/ceval.c b/Python/ceval.c index d28ae2b..faee5cd 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2083,7 +2083,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) } else { x = PyObject_GetItem(v, w); - if (x == NULL && PyErr_Occurred()) { + if (x == NULL && _PyErr_OCCURRED()) { if (!PyErr_ExceptionMatches( PyExc_KeyError)) break; @@ -2127,7 +2127,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) (PyDictObject *)f->f_builtins, w); if (x == NULL) { - if (!PyErr_Occurred()) + if (!_PyErr_OCCURRED()) format_exc_check_arg(PyExc_NameError, GLOBAL_NAME_ERROR_MSG, w); break; -- cgit v0.12