Skip to content

Commit

Permalink
Merge pull request #688 from dmamelin/master
Browse files Browse the repository at this point in the history
remove redundant second await in ast_await
  • Loading branch information
craigbarratt authored Jan 21, 2025
2 parents 9b8526f + 864add6 commit 9465f98
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 9465f98

Please sign in to comment.