Skip to content

remove redundant second await in ast_await #688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions custom_components/pyscript/eval.py
Original file line number Diff line number Diff line change
@@ -2020,10 +2020,7 @@ async def ast_formattedvalue(self, arg):

async def ast_await(self, arg):
"""Evaluate await expr."""
coro = await self.aeval(arg.value)
if coro:
return await coro
return None
return await self.aeval(arg.value)

async def get_target_names(self, lhs):
"""Recursively find all the target names mentioned in the AST tree."""
9 changes: 9 additions & 0 deletions tests/test_unit_eval.py
Original file line number Diff line number Diff line change
@@ -1406,6 +1406,15 @@ def bar():
""",
["bar"],
],
[
"""
async def func():
return 42
await func()
""",
42,
],
]