#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 #19014: memoryview.cast() is now allowed on zero-length views.
- Issue #19098: Prevent overflow in the compiler when the recursion limit is set
}
else {
x = PyObject_GetItem(v, w);
- if (x == NULL && PyErr_Occurred()) {
+ if (x == NULL && _PyErr_OCCURRED()) {
if (!PyErr_ExceptionMatches(
PyExc_KeyError))
break;
(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;