[pypy-issue] [issue1285] compileall fails on unicode

Jon Oberheide tracker at bugs.pypy.org
Wed Oct 10 22:58:22 CEST 2012


New submission from Jon Oberheide <jonojono at umich.edu>:

unicode exceptions thrown when doing a compileall on files with certain unicode:

# pypy -m compileall foo.py
Compiling foo.py ...
Traceback (most recent call last):
  File "app_main.py", line 51, in run_toplevel
  File "/lib-python/2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/lib-python/2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/lib-python/2.7/compileall.py", line 226, in <module>
    exit_status = int(not main())
  File "/lib-python/2.7/compileall.py", line 216, in main
    if not compile_file(arg, ddir, force, rx, quiet):
  File "/lib-python/2.7/compileall.py", line 99, in compile_file
    ok = py_compile.compile(fullname, None, dfile, True)
  File "/lib-python/2.7/py_compile.py", line 126, in compile
    marshal.dump(codeobject, fc)
UnicodeEncodeError: 'utf-8' codec can't encode character u'\udf42' in position 0: surrogates not 
allowed
# cat foo.py
foo = u'\udf42'

works fine on python 2.7.3:

$ python -m compileall foo.py 
Compiling foo.py ...
$ cat foo.py
foo = u'\udf42'

----------
messages: 4836
nosy: jonojono, pypy-issue
priority: bug
status: unread
title: compileall fails on unicode

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1285>
________________________________________


More information about the pypy-issue mailing list