Issue #12636: IDLE reads the coding cookie when executing a Python script.

This commit is contained in:
Victor Stinner 2011-09-02 01:00:40 +02:00
parent 85c6772aec
commit 979482a315
2 changed files with 8 additions and 5 deletions

View File

@ -1,16 +1,17 @@
#! /usr/bin/env python3 #! /usr/bin/env python3
import getopt
import os import os
import os.path import os.path
import sys
import getopt
import re import re
import socket import socket
import time import subprocess
import sys
import threading import threading
import time
import tokenize
import traceback import traceback
import types import types
import subprocess
import linecache import linecache
from code import InteractiveInterpreter from code import InteractiveInterpreter
@ -572,7 +573,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
def execfile(self, filename, source=None): def execfile(self, filename, source=None):
"Execute an existing file" "Execute an existing file"
if source is None: if source is None:
with open(filename, "r") as fp: with tokenize.open(filename) as fp:
source = fp.read() source = fp.read()
try: try:
code = compile(source, filename, "exec") code = compile(source, filename, "exec")

View File

@ -28,6 +28,8 @@ Core and Builtins
Library 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 - Issue #10946: The distutils commands bdist_dumb, bdist_wininst and bdist_msi
now respect a --skip-build option given to bdist. now respect a --skip-build option given to bdist.