Skip to content

Commit

Permalink
fix top-level await in ipython
Browse files Browse the repository at this point in the history
  • Loading branch information
zhu authored and jonathanslenders committed Nov 3, 2023
1 parent 945426b commit 9ea3238
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ptpython/ipython.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

from .completer import PythonCompleter
from .python_input import PythonInput
from .repl import PyCF_ALLOW_TOP_LEVEL_AWAIT
from .style import default_ui_style
from .validator import PythonValidator

Expand Down Expand Up @@ -211,6 +212,12 @@ def __init__(self, ipython_shell, *a, **kw):
self.ui_styles = {"default": Style.from_dict(style_dict)}
self.use_ui_colorscheme("default")

def get_compiler_flags(self):
flags = super().get_compiler_flags()
if self.ipython_shell.autoawait:
flags |= PyCF_ALLOW_TOP_LEVEL_AWAIT
return flags


class InteractiveShellEmbed(_InteractiveShellEmbed):
"""
Expand Down

0 comments on commit 9ea3238

Please sign in to comment.