mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
gh-124960: Fixed `barry_as_FLUFL` future flag does not work in new REPL (#124999)
Co-authored-by: Wulian <xiguawulian@gmail.com>
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 6a08a753b7
)
This commit is contained in:
parent
cbcdf34a4b
commit
d54dbd62cc
4 changed files with 40 additions and 5 deletions
|
@ -174,7 +174,13 @@ class InteractiveColoredConsole(code.InteractiveConsole):
|
|||
|
||||
def runsource(self, source, filename="<input>", symbol="single"):
|
||||
try:
|
||||
tree = ast.parse(source)
|
||||
tree = self.compile.compiler(
|
||||
source,
|
||||
filename,
|
||||
"exec",
|
||||
ast.PyCF_ONLY_AST,
|
||||
incomplete_input=False,
|
||||
)
|
||||
except (SyntaxError, OverflowError, ValueError):
|
||||
self.showsyntaxerror(filename, source=source)
|
||||
return False
|
||||
|
@ -185,7 +191,7 @@ class InteractiveColoredConsole(code.InteractiveConsole):
|
|||
the_symbol = symbol if stmt is last_stmt else "exec"
|
||||
item = wrapper([stmt])
|
||||
try:
|
||||
code = self.compile.compiler(item, filename, the_symbol, dont_inherit=True)
|
||||
code = self.compile.compiler(item, filename, the_symbol)
|
||||
except SyntaxError as e:
|
||||
if e.args[0] == "'await' outside function":
|
||||
python = os.path.basename(sys.executable)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue