[Python-checkins] cpython (merge 3.3 -> default): Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at least
antoine.pitrou
python-checkins at python.org
Mon Oct 7 20:41:32 CEST 2013
http://hg.python.org/cpython/rev/19954e5dbef5
changeset: 86141:19954e5dbef5
parent: 86139:516576f5f9dc
parent: 86140:2aee9c41bb79
user: Antoine Pitrou <solipsis at pitrou.net>
date: Mon Oct 07 20:40:59 2013 +0200
summary:
Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at least one place so as to avoid regressions.
files:
Include/pyerrors.h | 2 +-
Misc/NEWS | 3 +++
Python/ceval.c | 4 ++--
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -101,7 +101,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 --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,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 #19087: Improve bytearray allocation in order to allow cheap popping
of data at the front (slice deletion).
diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2162,7 +2162,7 @@
}
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();
@@ -2207,7 +2207,7 @@
(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;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list