Skip to content

Commit

Permalink
Fix usage of ast.Module
Browse files Browse the repository at this point in the history
  • Loading branch information
binste committed Jul 9, 2023
1 parent f6b03c6 commit 2624a6b
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions altair/utils/execeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
import sys


if sys.version_info >= (3, 9):
Module = ast.Module
else:
# Mock the Python >= 3.8 API
def Module(nodelist, type_ignores):
return ast.Module(nodelist)


class _CatchDisplay:
"""Class to temporarily catch sys.displayhook"""

Expand Down Expand Up @@ -48,7 +40,7 @@ def eval_block(code, namespace=None, filename="<string>"):
to_exec, to_eval = tree.body, []

for node in to_exec:
compiled = compile(Module([node], []), filename=filename, mode="exec")
compiled = compile(ast.Module([node], []), filename=filename, mode="exec")
exec(compiled, namespace)

with catch_display:
Expand Down

0 comments on commit 2624a6b

Please sign in to comment.