bpo-44524: Do not set _name of _SpecialForm without need by serhiy-storchaka · Pull Request #27861 · python/cpython (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Personally I don't think setting _name on _SpecialForms will break anything (because they aren't subclassable, and any methods they need are overridden, so their MRO doesn't matter). But I've been wrong on multiple occasions at this point 😉 , so let's just be safe. From a technical standpoint, Serhiy's solution is much cleaner (and faster) too.

PS @serhiy-storchaka , you can do the same for Annotated and copy the test over from my PR #27841. I'm closing that so we don't have to deal with merging multiple PRs.