[issue13032] h2py.py can fail with UnicodeDecodeError

STINNER Victor report at bugs.python.org
Mon Oct 17 01:29:46 CEST 2011


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

Using your patch, h2py.py skips all statements that cannot be decoded from UTF-8, whereas unpatched h2py.py accepts all statements that can be decoded from the locale encoding. I don't know if it is intentional to accept non-ASCII statements. It is maybe safer to ensure that a statement is encodable to ASCII using:

try:
    stmt.encode('ASCII')
    exec(stmt, env)
except:
    ...

Anyway, I would prefer to just drop this script with all Lib/plat-*/ directoes. I reopened this topic on python-dev (I already asked when I was working on the sys.platform=="linux3" issue: #12326).

----------

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


More information about the Python-bugs-list mailing list