Nick Coghlan writes: > For compatibility with file encoding declarations, I believe this > needs to be relaxed to starting with '#!python' in the source file > encoding, rather than strictly b'#!python' (which will only be the > case for ASCII compatible encodings).
In any PEP-263-compatible encoding it will be b'#!python'. Relaxing this is excessive generality for a new feature. I'm not sure what you mean by file encoding declarations if not PEP 263, which requires approximate[1] ASCII compatibility. PEP 3120 simply builds on PEP 263 by making UTF-8, rather than ISO 8859/1, the default encoding. > My rationale is that installers are going to need to read the source > file encoding for the scripts anyway, otherwise they may write the > shebang line back out with the wrong encoding, potentially leading to > decoding errors when attempting to run the script. Too bad if there's no PEP 263 declaration and the file is not in ASCII. I.e., the intersection of Python 2 and Python 3 default encodings. Footnotes: [1] Ie, Shift JIS and Big 5, or any encoding in which a pure ASCII string can be interpreted as a string in that encoding, are OK, but UTF-16 is not. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com