(original) (raw)
changeset: 86140:2aee9c41bb79 branch: 3.3 parent: 86136:b4444d16e333 user: Antoine Pitrou solipsis@pitrou.net date: Mon Oct 07 20:38:51 2013 +0200 files: Include/pyerrors.h Misc/NEWS Python/ceval.c description: Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at least one place so as to avoid regressions. diff -r b4444d16e333 -r 2aee9c41bb79 Include/pyerrors.h --- a/Include/pyerrors.h Sun Oct 06 21:22:42 2013 +0200 +++ b/Include/pyerrors.h Mon Oct 07 20:38:51 2013 +0200 @@ -100,7 +100,7 @@ #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 -r b4444d16e333 -r 2aee9c41bb79 Misc/NEWS --- a/Misc/NEWS Sun Oct 06 21:22:42 2013 +0200 +++ b/Misc/NEWS Mon Oct 07 20:38:51 2013 +0200 @@ -12,6 +12,9 @@ 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 diff -r b4444d16e333 -r 2aee9c41bb79 Python/ceval.c --- a/Python/ceval.c Sun Oct 06 21:22:42 2013 +0200 +++ b/Python/ceval.c Mon Oct 07 20:38:51 2013 +0200 @@ -2083,7 +2083,7 @@ } 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 @@ (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; /solipsis@pitrou.net