Closed akonradi closed 11 months ago
Thanks for fixing this issues and submitting a PR. There are two pylint
errors; could you fix those please?
custom_components/pyscript/eval.py:1758:16: C0103: Variable name "e" doesn't conform to snake_case naming style (invalid-name)
custom_components/pyscript/eval.py:1758:16: W0612: Unused variable 'e' (unused-variable)
Whoops, fixed.
Awesome! Thanks for the PR. Somehow I missed the original issue.
When iterating over a generator expression
gen
in a list comprehension[for x in gen]
, the local variablex
holds the value of each generated expression. When the list comprehension is done being evaluated, the local variablex
needs to be deleted. This was already being done. If, however,gen
is empty,x
is never defined, and so deleting it causes an error. This patch adds a check to ignore that error.Fixes #236