]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at least one...
authorAntoine Pitrou <solipsis@pitrou.net>
Mon, 7 Oct 2013 18:38:51 +0000 (20:38 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Mon, 7 Oct 2013 18:38:51 +0000 (20:38 +0200)
Include/pyerrors.h
Misc/NEWS
Python/ceval.c

index af37410e2338cc541624c7a78ab4e800eeea4a48..e38512307e0dffb335b755943a78b9ed3201d5fe 100644 (file)
@@ -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 */
index 5fa769584f2da5edc85943fd54e449db9ebdc2dc..d7d5644a3f80ac38450e156cd67cdd356fd80193 100644 (file)
--- 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
index d28ae2ba0511314ed954b517db7968385b2aff2d..faee5cd44d511358ea27e4e14f185b171de31926 100644 (file)
@@ -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;