summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Include/pyerrors.h2
-rw-r--r--Misc/NEWS3
-rw-r--r--Python/ceval.c4
3 files changed, 6 insertions, 3 deletions
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index f89d1ad..224567b 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -101,7 +101,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 66c3c73..f2d9695 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ Projected release date: 2013-10-20
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
of data at the front (slice deletion).
diff --git a/Python/ceval.c b/Python/ceval.c
index fcc1c24..dcfe8ec 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2162,7 +2162,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
}
else {
v = PyObject_GetItem(locals, name);
- if (v == NULL && PyErr_Occurred()) {
+ if (v == NULL && _PyErr_OCCURRED()) {
if (!PyErr_ExceptionMatches(PyExc_KeyError))
goto error;
PyErr_Clear();
@@ -2207,7 +2207,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
(PyDictObject *)f->f_builtins,
name);
if (v == NULL) {
- if (!PyErr_Occurred())
+ if (!_PyErr_OCCURRED())
format_exc_check_arg(PyExc_NameError,
NAME_ERROR_MSG, name);
goto error;