Author brandtbucher
Recipients brandtbucher, gvanrossum, quentel
Date 2021-07-09.17:06:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1625850393.69.0.304520730933.issue44589@roundup.psfhosted.org>
In-reply-to
Content
Nice find! In my opinion, we should do two things here:

- Update PEP 638 to specify that a SyntaxError is raised "if *any duplicate* key patterns are literal patterns". This was absolutely our original intention... I think the nuances were just lost in the final phrasing. I can take care of that PR.

- Update the compiler to raise SyntaxErrors for duplicate literal keys. It should be as simple as updating the first loop in compiler_pattern_mapping to build a set containing the values of any literal keys and raise on duplicates (and adding/updating tests, of course). We'll want to make sure we have test coverage of edge cases like {0: _, False: _}, {0: _, 0.0: _}, {0: _, -0: _}, {0: _, 0j: _}, etc.

Since you found this, you get first dibs on a PR. Otherwise, I have a few first-time contributors who would probably be interested.
History
Date User Action Args
2021-07-09 17:06:33brandtbuchersetrecipients: + brandtbucher, gvanrossum, quentel
2021-07-09 17:06:33brandtbuchersetmessageid: <1625850393.69.0.304520730933.issue44589@roundup.psfhosted.org>
2021-07-09 17:06:33brandtbucherlinkissue44589 messages
2021-07-09 17:06:33brandtbuchercreate