Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r60643:94b14a170aad
Date: 2013-01-28 17:06 -0800
http://bitbucket.org/pypy/pypy/changeset/94b14a170aad/

Log:    read arbitrary .py files in binary mode

diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py
--- a/pypy/interpreter/app_main.py
+++ b/pypy/interpreter/app_main.py
@@ -587,9 +587,8 @@
                 python_startup = readenv and os.getenv('PYTHONSTARTUP')
                 if python_startup:
                     try:
-                        f = open(python_startup)
-                        startup = f.read()
-                        f.close()
+                        with open(python_startup, 'rb') as f:
+                            startup = f.read()
                     except IOError as e:
                         print("Could not open PYTHONSTARTUP", file=sys.stderr)
                         print("IOError:", e, file=sys.stderr)
@@ -642,7 +641,7 @@
                 else:
                     # no.  That's the normal path, "pypy stuff.py".
                     def execfile(filename, namespace):
-                        with open(filename) as f:
+                        with open(filename, 'rb') as f:
                             code = f.read()
                         exec_(compile(code, filename, 'exec'), namespace)
                     args = (execfile, filename, mainmodule.__dict__)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to