Uh oh!
There was an error while loading. Please reload this page.
gh-138912: Improve MATCH_CLASS opcode performance - #138915
Conversation
| if (seen == NULL) { | ||
| return NULL; | ||
| PyObject *seen = NULL; | ||
| if (nattrs > 1) { |
There was a problem hiding this comment.
| if (nattrs>1) { | |
| if (nargs>1|| (nargs==1&&nkwargs>0)) { |
As mentioned in #138912, I'd also like to change this. If there are only keyword arguments, it's easy to see if two are the same name. Furthermore linters are able to detect these based on the AST alone.
It would also be great to say if we could suggest users to prefer keyword arguments. Not only are they more explicit, they are also faster. (No lookup of __match_args__ and, with the change, no expensive duplicate name detection.)
There was a problem hiding this comment.
Added this in f585253 with if (nargs > 0 && nattrs > 1). I can revert it if necessary.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
eendebakpt
commented
Nov 11, 2025
The CI failure seems unrelated. Updating the branch to rerun the CI just to be sure. |
359df88 to
e0c2c1eComparecdce8p
commented
Feb 14, 2026
Thanks for the review @gpshead. Is this change something which could be backported to |
gpshead
commented
Feb 16, 2026
Sorry, we only backport bugfixes and documentation updates. |
Uh oh!
There was an error while loading. Please reload this page.