This repository has been archived by the owner on Sep 20, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
python: Read python source as bytes
Syntastic unsets LC_ALL when running commands, this leads to `compile.py` dying horribly when encountering non-ascii characters in source code running under Python 3. Consuming the input source as bytes and passing this directly to `compile` solves this:
- Loading branch information
f0f4c38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to me having some LC_* settings set to non-default locales, unsetting LC_ALL (which Syntastic does) causes Python 3 to barf up a decoding error when trying to compile a source file containing a unicode literal.
Contents of
reprod.py
:$ LC_ALL="" TERM=dumb python2 compile.py reprod.py reprod.py:1:4: unexpected indent
After reading source as bytes:
$ LC_ALL="" TERM=dumb python2 compile.py reprod.py reprod.py:1:4: unexpected indent
$ LC_ALL="" TERM=dumb python3 compile.py reprod.py reprod.py:1:4: unexpected indent