Skip to content

Commit 9465f98

Browse files
authored
Merge pull request #688 from dmamelin/master
remove redundant second await in ast_await
2 parents 9b8526f + 864add6 commit 9465f98

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

custom_components/pyscript/eval.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -2020,10 +2020,7 @@ async def ast_formattedvalue(self, arg):
20202020

20212021
async def ast_await(self, arg):
20222022
"""Evaluate await expr."""
2023-
coro = await self.aeval(arg.value)
2024-
if coro:
2025-
return await coro
2026-
return None
2023+
return await self.aeval(arg.value)
20272024

20282025
async def get_target_names(self, lhs):
20292026
"""Recursively find all the target names mentioned in the AST tree."""

tests/test_unit_eval.py

+9
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,15 @@ def bar():
14061406
""",
14071407
["bar"],
14081408
],
1409+
[
1410+
"""
1411+
async def func():
1412+
return 42
1413+
1414+
await func()
1415+
""",
1416+
42,
1417+
],
14091418
]
14101419

14111420

0 commit comments

Comments
 (0)