First level attribute can be unbound
Closed this issue · 1 comments
janjagusch commented
There is a change that you never enter the while loop, which makes the first_level
attribute undefined.
Lines 395 to 408 in efcfdb8
This can cause the following error.
UnboundLocalError: cannot access local variable 'first_level' where it is not associated with a value
I feel like this should have been caught by some pre-commit hook (e.g. mypy
).
janjagusch commented
Doesn't seem to be so easy to catch this with a pre-commit hook (see python/mypy#2400).