Linux users: please run gui tests

Terry Reedy tjreedy at udel.edu
Sat Aug 29 06:48:57 CEST 2015


On 8/28/2015 4:52 AM, Christian Gollwitzer wrote:

> Here is a small patch which improves the error message a lot:
> diff -ru Python-3.4.3/Modules/_tkinter.c
> Python-3.4.3-patched/Modules/_tkinter.c
> --- Python-3.4.3/Modules/_tkinter.c    2015-02-25 12:27:45.000000000 +0100
> +++ Python-3.4.3-patched/Modules/_tkinter.c    2015-08-28
> 10:27:15.000000000 +0200
> @@ -276,7 +276,8 @@
>   static PyObject *
>   Tkinter_Error(PyObject *v)
>   {
> -    PyErr_SetString(Tkinter_TclError, Tkapp_Result(v));
> +    const char *errorInfo = Tcl_GetVar(Tkapp_Interp(v), "errorInfo",
> TCL_GLOBAL_ONLY);
> +    PyErr_SetString(Tkinter_TclError, errorInfo);
>       return NULL;
>   }
>
>
> Instead of just the error, this prints the full Tcl stack trace.
>
> Compare:
> =========== before ============
> Apfelkiste:Python-3.4.3 chris$ ./python.exe
> Python 3.4.3 (default, Aug 28 2015, 10:33:48)
> [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import tkinter; root=tkinter.Tk()
>  >>> root.eval("grid rowconfigure . 0 -weight {}")
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> _tkinter.TclError: expected integer but got ""
> =============================
>
> with
>
> =========== after =============
> Apfelkiste:Python-3.4.3-patched chris$ ./python.exe
> Python 3.4.3 (default, Aug 28 2015, 10:29:50)
> [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import tkinter; root=tkinter.Tk()
>  >>> root.eval("grid rowconfigure . 0 -weight {}")
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
> _tkinter.TclError: expected integer but got ""
>      while executing
> "grid rowconfigure . 0 -weight {}"
>  >>>
> ==================================
>
> Is there a chance to get this fixed upstream in Tkinter?

There might be if someone opened a new tkinter tracker issue for this. 
Can you do so?

-- 
Terry Jan Reedy



More information about the Python-list mailing list