summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-10-03 17:12:26 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-10-03 17:12:26 (GMT)
commitd46e684edd5b75f9674af2acd730c1a2f03655ed (patch)
tree18abdb84cb0b24abd461a4b1b5147a4c148c79bf
parent664a27133c69f63bd62a3a150052ea02530f3f5b (diff)
downloadcpython-d46e684edd5b75f9674af2acd730c1a2f03655ed.zip
cpython-d46e684edd5b75f9674af2acd730c1a2f03655ed.tar.gz
cpython-d46e684edd5b75f9674af2acd730c1a2f03655ed.tar.bz2
Check for TclError when reading variables. Fixes #807314.
Backported to 2.3.
-rw-r--r--Modules/_tkinter.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 5253a10..02e4feb 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;