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 ncoghlan
Recipients Vadim Pushtaev, ncoghlan, ppperry, serhiy.storchaka
Date 2018-08-04.15:44:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1533397481.74.0.56676864532.issue34284@psf.upfronthosting.co.za>
In-reply-to
Content
Looking at the code in https://github.com/python/cpython/blob/e42b705188271da108de42b55d9344642170aa2b/Python/sysmodule.c#L2360, I think the underlying problem here is that the code to make these PyStructSequence subclasses uninstantiable isn't really right - rather than clearing those fields in the subclass (which still allows dynamic method lookup to fall back to the parent class, even though fast C level dispatch fails), it would be more consistent and reliable to replace them with implementations that always raise a TypeError with a suitable message.

(An alternative may be to implement the same behaviour as the builtin singleton types used for None and Ellipsis: replace __new__ with an implementation that always returns the original singleton instance. However, there isn't a compelling use case, so raising a descriptive exception along the lines of what ppperry suggests seems most appropriate)
History
Date User Action Args
2018-08-04 15:44:41ncoghlansetrecipients: + ncoghlan, serhiy.storchaka, ppperry, Vadim Pushtaev
2018-08-04 15:44:41ncoghlansetmessageid: <1533397481.74.0.56676864532.issue34284@psf.upfronthosting.co.za>
2018-08-04 15:44:41ncoghlanlinkissue34284 messages
2018-08-04 15:44:41ncoghlancreate