Skip to content

Commit 59c900d

Browse files
committed
Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at least one place so as to avoid regressions.
1 parent c377fe2 commit 59c900d

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Include/pyerrors.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ PyAPI_FUNC(void) Py_FatalError(const char *message) _Py_NO_RETURN;
100100
#if defined(Py_DEBUG) || defined(Py_LIMITED_API)
101101
#define _PyErr_OCCURRED() PyErr_Occurred()
102102
#else
103-
#define _PyErr_OCCURRED() (_PyThreadState_Current->curexc_type)
103+
#define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type)
104104
#endif
105105

106106
/* Error testing and normalization */

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ What's New in Python 3.3.3 release candidate 1?
1212
Core and Builtins
1313
-----------------
1414

15+
- Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at
16+
least one place so as to avoid regressions.
17+
1518
- Issue #19014: memoryview.cast() is now allowed on zero-length views.
1619

1720
- Issue #19098: Prevent overflow in the compiler when the recursion limit is set

Python/ceval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
20832083
}
20842084
else {
20852085
x = PyObject_GetItem(v, w);
2086-
if (x == NULL && PyErr_Occurred()) {
2086+
if (x == NULL && _PyErr_OCCURRED()) {
20872087
if (!PyErr_ExceptionMatches(
20882088
PyExc_KeyError))
20892089
break;
@@ -2127,7 +2127,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
21272127
(PyDictObject *)f->f_builtins,
21282128
w);
21292129
if (x == NULL) {
2130-
if (!PyErr_Occurred())
2130+
if (!_PyErr_OCCURRED())
21312131
format_exc_check_arg(PyExc_NameError,
21322132
GLOBAL_NAME_ERROR_MSG, w);
21332133
break;

0 commit comments

Comments
 (0)