mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
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).
This commit is contained in:
parent
bbdc08ea6e
commit
6c47102982
3 changed files with 15 additions and 1 deletions
|
@ -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
|
||||
with open(fname, "rU") as f:
|
||||
with open(fname, "rb") as f:
|
||||
code = compile(f.read(), fname, 'exec')
|
||||
return code
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue