[3.13] gh-124960: Fixed barry_as_FLUFL future flag does not work in new REPL (#124999) (#125475)

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:
Nice Zombies 2024-10-14 20:00:45 +02:00 committed by GitHub
parent cbcdf34a4b
commit d54dbd62cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 5 deletions

View file

@ -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)