[issue20368] Tkinter: handle the null character

Serhiy Storchaka report at bugs.python.org
Mon Feb 3 11:08:28 CET 2014


Serhiy Storchaka added the comment:

> But, how many of the replacement sites are exercised by the tests?

I added tests for most the replacement sites and updated tests has even more tests.

split() and splitlist() -- tested. Unfortunately they are tested only for bytes argument because these methods reject unicode string argument with NUL.

Tcl_Obj.string, Tcl_Obj.typename and Tcl_Obj.__str__() -- not tested. There are no explicit tests for these properties and methods. Seems as Tcl_Obj.typename can't be tested for NUL.

eval(), evalfile() -- tested.

Variable's methods -- tested.

exprstring() -- tested. I added tests for exprstring(), exprdouble(), exprlong(), exprboolean() in the patch.

record() -- not tested. There are no explicit tests for record() and I have no ideas how it can be used in Python.

C functions:

FromObj() and Tkapp_CallResult() -- implicitly tested in a lot of tests, in particular in test_passing_values and test_user_command.

PythonCmd() -- tested in test_user_command.


> There are a few changes that seem unrelated to nulls, which might have been left for another patch.

They are just make code more robust. For example Tcl can be compiled with TCL_UTF_MAX=6. In this case Python will work correctly most time but can work incorrectly or crash on specific rare data. With proposed changes it will raise SystemError early. Yes, it is worth separate issue.

> Do you know if this code block is tested.

It is implicitly tested in many tests which tests non-ASCII strings.

----------
Added file: http://bugs.python.org/file33884/tkinter_null_character_2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20368>
_______________________________________


More information about the Python-bugs-list mailing list