]> granicus.if.org Git - python/commitdiff
Issue #12636: IDLE reads the coding cookie when executing a Python script.
authorVictor Stinner <victor.stinner@haypocalc.com>
Thu, 1 Sep 2011 23:00:40 +0000 (01:00 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Thu, 1 Sep 2011 23:00:40 +0000 (01:00 +0200)
Lib/idlelib/PyShell.py
Misc/NEWS

index d15034f9299e25a507bff9c4fbe9920a2d3a46b9..da7472909969ebf6ab9930d3080074dde3b6e41e 100644 (file)
@@ -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")
index b17c58f4d0330b12737c602247209253ef355233..c74cb5596d71f7f406ea39ae081fe1a69f5e177a 100644 (file)
--- 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.