cpython: cd1759711357 (original) (raw)

Mercurial > cpython

changeset 71164:cd1759711357 3.2

Issue #12451: runpy: run_path() now opens the Python script in binary mode, instead of text mode using the locale encoding, to support other encodings than UTF-8 (scripts using the coding cookie). [#12451]

Victor Stinner victor.stinner@haypocalc.com
date Mon, 04 Jul 2011 01:45:39 +0200
parents 81424281ee59
children e240af1f0ae1 a1b4f1716b73
files Lib/runpy.py Lib/test/test_runpy.py Misc/NEWS
diffstat 3 files changed, 15 insertions(+), 1 deletions(-)[+] [-] Lib/runpy.py 2 Lib/test/test_runpy.py 10 Misc/NEWS 4

line wrap: on

line diff

--- a/Lib/runpy.py +++ b/Lib/runpy.py @@ -226,7 +226,7 @@ def _get_code_from_file(fname): code = read_code(f) if code is None: # That didn't work, so try it as normal source code

--- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -405,6 +405,16 @@ argv0 = sys.argv[0] msg = "recursion depth exceeded" self.assertRaisesRegex(RuntimeError, msg, run_path, zip_name)

+#coding:latin1 +"non-ASCII: h\xe9" +""")

def test_main():

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,6 +19,10 @@ Core and Builtins Library ------- +- Issue #12451: runpy: run_path() now opens the Python script in binary mode,