[Python-Dev] PEP 427: wheel (original) (raw)

Stephen J. Turnbull stephen at xemacs.org
Sat Feb 16 12:14:39 CET 2013


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.



More information about the Python-Dev mailing list