]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Check for TclError when reading variables. Fixes #807314.
authorMartin v. Löwis <martin@v.loewis.de>
Fri, 3 Oct 2003 17:11:45 +0000 (17:11 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Fri, 3 Oct 2003 17:11:45 +0000 (17:11 +0000)
Misc/NEWS
Modules/_tkinter.c

index 7ac669b7c98817b74296a79e9849551a3e9d002f..69a810f09af5071e1bb1410cf32a3ef301052b65 100644 (file)
--- 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)?
 ===================================
 
index 5253a106032dcce1b7adc5c66c2f6033b3cf1a1f..02e4feb47f30df4ee8b7b060165e13522898228e 100644 (file)
@@ -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;