[BUG] 2.0.3 update causes 'Tuple' object has no attribute 'value'
sdebruyn opened this issue Β· comments
After the update from 2.0.2 to 2.0.3 I get 100+ errors mentioning 'Tuple' object has no attribute 'value'
The code with the error doesn't have any tuples, however its imports do have an from typing import Tuple
Python 3.9, ubuntu 20.04
I'm seeing this with both Tuple
and Name
in multiple files in my project. However, I'm not even seeing those keys in the files
I've worked up a simple reproduction case:
It appears that the fixes to allow generic types to work better now have an issue if you don't use a string in the generic type definition.
This generates the error 'Name' object has no attribute 'value'
:
def reproduction(value: list[dict]) -> None:
pass
This works fine:
def reproduction(value: list['dict']) -> None:
pass
If you do the below you get 'BinOp' object has no attribute 'value'
def reproduction(value: list[int | str]) -> None:
pass
I've not figured out exactly what can trigger the Tuple
version of this error, but it all appears to be a lack of type checking when parsing the subtype of the generics?
After investigating, this seems to be related to some ast
module changes in Python3.9+...
I'll fix it as soon as possible and release v2.0.4...
Thanks for the prompt engagement on both this and my last report! :)
I've not figured out exactly what can trigger the
Tuple
version of this error, but it all appears to be a lack of type checking when parsing the subtype of the generics?
Lines 381 to 396 in d1ac94f
It's line 394.
actually using the else statement in line388 and 394 is a really bad idea π
actually using the else statement in line388 and 394 is a really bad idea π
I almost always wonder wtf past me was thinking when I'm bug fixing <_<
actually using the else statement in line388 and 394 is a really bad idea π
I almost always wonder wtf past me was thinking when I'm bug fixing <_<
That always happens, actually, this time I've well tested the edge cases but I've missed the normal/main one π.
@hadialqattan I've tested 2.0.4 against my project and both #161 and #154 are looking good. Thanks again!