diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-09-01 23:00:40 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-09-01 23:00:40 (GMT) |
commit | 979482a3154540ffde1cb0f374cab4421995660d (patch) | |
tree | d62bfc669116b4425e2fc3afb224b1058119458b /Lib/idlelib | |
parent | 85c6772aecd9cdcd87c9f4ede62dce041f581890 (diff) | |
download | cpython-979482a3154540ffde1cb0f374cab4421995660d.zip cpython-979482a3154540ffde1cb0f374cab4421995660d.tar.gz cpython-979482a3154540ffde1cb0f374cab4421995660d.tar.bz2 |
Issue #12636: IDLE reads the coding cookie when executing a Python script.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/PyShell.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index d15034f..da74729 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -1,16 +1,17 @@ #! /usr/bin/env python3 +import getopt import os import os.path -import sys -import getopt import re import socket -import time +import subprocess +import sys import threading +import time +import tokenize import traceback import types -import subprocess import linecache from code import InteractiveInterpreter @@ -572,7 +573,7 @@ class ModifiedInterpreter(InteractiveInterpreter): def execfile(self, filename, source=None): "Execute an existing file" if source is None: - with open(filename, "r") as fp: + with tokenize.open(filename) as fp: source = fp.read() try: code = compile(source, filename, "exec") |