diff --git a/custom_components/pyscript/eval.py b/custom_components/pyscript/eval.py index 39ac56d..4ca5371 100644 --- a/custom_components/pyscript/eval.py +++ b/custom_components/pyscript/eval.py @@ -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.""" diff --git a/tests/test_unit_eval.py b/tests/test_unit_eval.py index 7deb97f..5983541 100644 --- a/tests/test_unit_eval.py +++ b/tests/test_unit_eval.py @@ -1406,6 +1406,15 @@ def bar(): """, ["bar"], ], + [ + """ +async def func(): + return 42 + +await func() +""", + 42, + ], ]