[Python-checkins] r58487 - sandbox/trunk/import_in_py/Py3K/_importlib.py

brett.cannon python-checkins at python.org
Mon Oct 15 23:00:24 CEST 2007


Author: brett.cannon
Date: Mon Oct 15 23:00:23 2007
New Revision: 58487

Modified:
   sandbox/trunk/import_in_py/Py3K/_importlib.py
Log:
Add an XXX comment listing an idea on how to deal with -*- stanzas.


Modified: sandbox/trunk/import_in_py/Py3K/_importlib.py
==============================================================================
--- sandbox/trunk/import_in_py/Py3K/_importlib.py	(original)
+++ sandbox/trunk/import_in_py/Py3K/_importlib.py	Mon Oct 15 23:00:23 2007
@@ -136,6 +136,12 @@
     try:
         # XXX Forcing UTF-8 is fine for a default but there are -*- stanzas to
         # worry about at some point.
+        # XXX Opening in UTF-8 prevents the import of heapq and test_coding to
+        #  fail at least.
+        # XXX Opening in Latin-1 causes test_pep263 and pep_3131 to fail.
+        # XXX One possible solution is to read the file in as bytes, do the
+        #  universal newline translation, and then look for the -*- stanza to
+        #  then do a bytes.decode() call (basically do PEPs 263 and 278).
         return open(path, flags, encoding=(None if 'b' in flags else "utf8"))
     except NameError:
         return DinkyFile(path, flags)


More information about the Python-checkins mailing list