[issue23672] IDLE can crash if file name contains non-BMP Unicode characters

Serhiy Storchaka report at bugs.python.org
Fri Aug 7 15:53:24 CEST 2015


Serhiy Storchaka added the comment:

Interesting, this doesn't work with non-UTF-8 locale.

$ touch astral𝔼.py
$ LC_ALL=en_US.iso88591 ./python -m idlelib.idle -e astral𝔼.py
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/serhiy/py/cpython/Lib/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/serhiy/py/cpython/Lib/idlelib/idle.py", line 11, in <module>
    idlelib.PyShell.main()
  File "/home/serhiy/py/cpython/Lib/idlelib/PyShell.py", line 1553, in main
    if flist.open(filename) is None:
  File "/home/serhiy/py/cpython/Lib/idlelib/FileList.py", line 36, in open
    edit = self.EditorWindow(self, filename, key)
  File "/home/serhiy/py/cpython/Lib/idlelib/PyShell.py", line 123, in __init__
    EditorWindow.__init__(self, *args)
  File "/home/serhiy/py/cpython/Lib/idlelib/EditorWindow.py", line 288, in __init__
    if io.loadfile(filename):
  File "/home/serhiy/py/cpython/Lib/idlelib/IOBinding.py", line 244, in loadfile
    self.updaterecentfileslist(filename)
  File "/home/serhiy/py/cpython/Lib/idlelib/IOBinding.py", line 525, in updaterecentfileslist
    self.editwin.update_recent_files_list(filename)
  File "/home/serhiy/py/cpython/Lib/idlelib/EditorWindow.py", line 899, in update_recent_files_list
    if '\0' in path or not os.path.exists(path[0:-1]):
  File "/home/serhiy/py/cpython/Lib/genericpath.py", line 19, in exists
    os.stat(path)
UnicodeEncodeError: 'latin-1' codec can't encode character '\U0001d53c' in position 22: ordinal not in range(256)

----------
nosy: +serhiy.storchaka

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


More information about the Python-bugs-list mailing list