Message313848
Thanks Евгений Махмудов for the report!
The crux is this:
class A(NamedTuple):
value: bool = True
class B(A):
value: bool = False
B(True).value # Expected True, but is False
B(True)[0] # True as expected
If we add NamedTuple to B's bases or make its metaclass NamedTupleMeta, it works as expected.
Introspecting the classes a bit more suggests a cause: the class variable A.value is a <property ...>, but B.value is just False, and adding the extra base class or metaclass corrects this.
Ivan, you can probably tell what's wrong from this. Maybe it's hard to fix, because NamedTuple doesn't appear in A.__mro__? (IIRC there was a question about that somewhere recently too?) |
|
Date |
User |
Action |
Args |
2018-03-15 00:32:16 | gvanrossum | set | recipients:
+ gvanrossum, levkivskyi, Евгений Махмудов |
2018-03-15 00:32:16 | gvanrossum | set | messageid: <1521073936.68.0.467229070634.issue33077@psf.upfronthosting.co.za> |
2018-03-15 00:32:16 | gvanrossum | link | issue33077 messages |
2018-03-15 00:32:16 | gvanrossum | create | |
|