This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients gvanrossum, levkivskyi, Евгений Махмудов
Date 2018-03-15.00:32:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1521073936.68.0.467229070634.issue33077@psf.upfronthosting.co.za>
In-reply-to
Content
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?)
History
Date User Action Args
2018-03-15 00:32:16gvanrossumsetrecipients: + gvanrossum, levkivskyi, Евгений Махмудов
2018-03-15 00:32:16gvanrossumsetmessageid: <1521073936.68.0.467229070634.issue33077@psf.upfronthosting.co.za>
2018-03-15 00:32:16gvanrossumlinkissue33077 messages
2018-03-15 00:32:16gvanrossumcreate