Skip to content

Commit

Permalink
remove second await in ast_await, fixes custom-components#643, custom…
Browse files Browse the repository at this point in the history
  • Loading branch information
dmamelin committed Jan 21, 2025
1 parent 9b8526f commit 864add6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 1 addition & 4 deletions custom_components/pyscript/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
9 changes: 9 additions & 0 deletions tests/test_unit_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,15 @@ def bar():
""",
["bar"],
],
[
"""
async def func():
return 42
await func()
""",
42,
],
]


Expand Down

0 comments on commit 864add6

Please sign in to comment.