diff options
author | Wulian <xiguawulian@gmail.com> | 2024-10-14 13:53:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-14 13:53:50 (GMT) |
commit | 6a08a753b702ac63c9b6ac58dd204d1fe9662e9d (patch) | |
tree | 9942fe005e3c556672b05d3d01905ac083027838 /Lib/_pyrepl | |
parent | 5f4e5b598cab86d5fd5727d423c9728221889ed0 (diff) | |
download | cpython-6a08a753b702ac63c9b6ac58dd204d1fe9662e9d.zip cpython-6a08a753b702ac63c9b6ac58dd204d1fe9662e9d.tar.gz cpython-6a08a753b702ac63c9b6ac58dd204d1fe9662e9d.tar.bz2 |
gh-124960: Fixed `barry_as_FLUFL` future flag does not work in new REPL (#124999)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Ćukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Lib/_pyrepl')
-rw-r--r-- | Lib/_pyrepl/console.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/_pyrepl/console.py b/Lib/_pyrepl/console.py index 3e72a56..03266c4 100644 --- a/Lib/_pyrepl/console.py +++ b/Lib/_pyrepl/console.py @@ -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) |