[Python-checkins] cpython (3.2): Issue #12636: IDLE reads the coding cookie when executing a Python script.

victor.stinner python-checkins at python.org
Fri Sep 2 01:05:22 CEST 2011


http://hg.python.org/cpython/rev/fe7777f1ed14
changeset: 72173:fe7777f1ed14
branch: 3.2
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Fri Sep 02 01:00:40 2011 +0200
summary:
 Issue #12636: IDLE reads the coding cookie when executing a Python script.
files:
 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
--- 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 subprocess
+import sys
+import threading
 import time
-import threading
+import tokenize
 import traceback
 import types
-import subprocess
 
 import linecache
 from code import InteractiveInterpreter
@@ -572,7 +573,7 @@
 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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -28,6 +28,8 @@
 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.
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /