mirror of
https://github.com/python/cpython.git
synced 2025-09-11 11:17:16 +00:00
Patch #590913: PEP 263 support.
This commit is contained in:
parent
5428fff111
commit
eade4a1580
2 changed files with 188 additions and 1 deletions
|
@ -6,6 +6,7 @@ import string
|
|||
import getopt
|
||||
import re
|
||||
import warnings
|
||||
import types
|
||||
|
||||
import linecache
|
||||
from code import InteractiveInterpreter
|
||||
|
@ -188,6 +189,9 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
|||
self.more = 0
|
||||
self.save_warnings_filters = warnings.filters[:]
|
||||
warnings.filterwarnings(action="error", category=SyntaxWarning)
|
||||
if isinstance(source, types.UnicodeType):
|
||||
import IOBinding
|
||||
source = source.encode(IOBinding.encoding)
|
||||
try:
|
||||
return InteractiveInterpreter.runsource(self, source, filename)
|
||||
finally:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue