[Python-checkins] cpython (merge 3.4 -> default): (Merge 3.4) Issue #21418: Fix a crash in the builtin function super() when
victor.stinner
python-checkins at python.org
Tue May 13 01:33:19 CEST 2014
http://hg.python.org/cpython/rev/53cf343c4fff
changeset: 90670:53cf343c4fff
parent: 90668:3c26389d741c
parent: 90669:cee528d44b1e
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue May 13 01:32:54 2014 +0200
summary:
(Merge 3.4) Issue #21418: Fix a crash in the builtin function super() when
called without argument and without current frame (ex: embedded Python).
files:
Misc/NEWS | 3 +++
Objects/typeobject.c | 11 +++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
Core and Builtins
-----------------
+- Issue #21418: Fix a crash in the builtin function super() when called without
+ argument and without current frame (ex: embedded Python).
+
- Issue #21425: Fix flushing of standard streams in the interactive
interpreter.
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -6929,9 +6929,16 @@
if (type == NULL) {
/* Call super(), without args -- fill in from __class__
and first local variable on the stack. */
- PyFrameObject *f = PyThreadState_GET()->frame;
- PyCodeObject *co = f->f_code;
+ PyFrameObject *f;
+ PyCodeObject *co;
Py_ssize_t i, n;
+ f = PyThreadState_GET()->frame;
+ if (f == NULL) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "super(): no current frame");
+ return -1;
+ }
+ co = f->f_code;
if (co == NULL) {
PyErr_SetString(PyExc_RuntimeError,
"super(): no code object");
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list