From: Martin v. Löwis Date: Fri, 3 Oct 2003 17:11:45 +0000 (+0000) Subject: Check for TclError when reading variables. Fixes #807314. X-Git-Tag: v2.3.3c1~153 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fe161633889a1102a4794c6125b03f186c6fe472;p=thirdparty%2FPython%2Fcpython.git Check for TclError when reading variables. Fixes #807314. --- diff --git a/Misc/NEWS b/Misc/NEWS index 7ac669b7c988..69a810f09af5 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -14,6 +14,9 @@ Extension modules - Patch #813445: Add missing socket.IPPROTO_IPV6. +- Bug #807314: Properly raise an exception if non-existent Tcl + variable is accessed. + What's New in Python 2.3.2 (final)? =================================== diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 5253a106032d..02e4feb47f30 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -1647,11 +1647,15 @@ GetVar(PyObject *self, PyObject *args, int flags) ENTER_TCL tres = Tcl_GetVar2Ex(Tkapp_Interp(self), name1, name2, flags); ENTER_OVERLAP - if (((TkappObject*)self)->wantobjects) { - res = FromObj(self, tres); - } - else { - res = PyString_FromString(Tcl_GetString(tres)); + if (tres == NULL) { + PyErr_SetString(Tkinter_TclError, Tcl_GetStringResult(Tkapp_Interp(self))); + } else { + if (((TkappObject*)self)->wantobjects) { + res = FromObj(self, tres); + } + else { + res = PyString_FromString(Tcl_GetString(tres)); + } } LEAVE_OVERLAP_TCL return res;