[Python-3000] PEP 3131 accepted

Guillaume Proux gproux+py3000 at gmail.com
Thu May 24 04:14:15 CEST 2007


Regarding using looking-alike glyphs (in certain fonts) security
issues, wouldn't it be a good thing for any project anyway to have a
number of pre-conditions for any given contribution to a given project
to be cleared. On of such litmus tests would be like the following.
try:
     codecs.open("contributedfile.py","r","ascii")
     print("contribution accepted")
except UnicodeDecodeError:
     print("contribution rejected. evil non-ascii characters lurking
in your source. ")

(it should be possible (and this is left as exercise to the reader) to
use some regexp to first remove from the scope of the test strings and
comments or to use AST tools to make the tests directly on the
generated AST)

In Japan, replace the above "ascii" by "sjis" for example.

it should be fairly easy to write a number of tools that would
highlight "strange" characters in a piece of source code and I trust
that if there is such a need, the market for python specialized
editors (and other generic editors) will let you pick a different
color for characters that would not be part of the ascii set. Once
again, mostly a presentation and workflow issue that can be solved by
using the right tools or writing some very simple tools to work around
your favorite editor's lacks.

Regards,

Guillaume


More information about the Python-3000 mailing list