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 eric.smith
Recipients Ricyteach, eric.smith
Date 2018-03-26.10:28:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1522060137.7.0.467229070634.issue33141@psf.upfronthosting.co.za>
In-reply-to
Content
That's a tough one. Because C.d is not set to a descriptor at type creation time (it's set to a Field object), the __set_name__ behavior is never invoked. It's when the @dataclass decorator is called that C.d is set to D().

https://docs.python.org/3/reference/datamodel.html#creating-the-class-object

I'm not sure it's possible to work around this without duplicating some of the type creation code, and even then I'm not convinced it's doable.
History
Date User Action Args
2018-03-26 10:28:57eric.smithsetrecipients: + eric.smith, Ricyteach
2018-03-26 10:28:57eric.smithsetmessageid: <1522060137.7.0.467229070634.issue33141@psf.upfronthosting.co.za>
2018-03-26 10:28:57eric.smithlinkissue33141 messages
2018-03-26 10:28:57eric.smithcreate