Anonymous avatar Anonymous committed 19954e5 Merge

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

Comments (0)

Files changed (3)

Include/pyerrors.h

 #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 */
 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).
 
             }
             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();
                                        (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;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.