From 979482a3154540ffde1cb0f374cab4421995660d Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 2 Sep 2011 01:00:40 +0200 Subject: Issue #12636: IDLE reads the coding cookie when executing a Python script. --- Lib/idlelib/PyShell.py | 11 ++++++----- Misc/NEWS | 2 ++ 2 files changed, 8 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") diff --git a/Misc/NEWS b/Misc/NEWS index b17c58f..c74cb55 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -28,6 +28,8 @@ Core and Builtins Library ------- +- Issue #12636: IDLE reads the coding cookie when executing a Python script. + - Issue #10946: The distutils commands bdist_dumb, bdist_wininst and bdist_msi now respect a --skip-build option given to bdist. -- cgit v0.12