New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-42128: Add __match_args__ to structseq-based classes #24732
Conversation
|
||
Py_ssize_t i, k; | ||
for (i = k = 0; i < n_members; ++i) { | ||
if (desc->fields[i].name == PyStructSequence_UnnamedField) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can handle this in a better way: just exclude them from match_args. The other (much worse option IMHO) is generate some missing names for these.
Done in 40bf3b7 |
Looking a bit closer... should we limit this to only Plus, we can always extend it later if it turns out to be an unnecessary limitation. |
Good point! I agree with that. I have pushed a new commit with this limitation. |
I considered that, but I think the code would be harder to read because appending to the list can fail on every iteration and we also need to covert the list to a tuple that can also fail. Also it will be less efficient so I decided with the current approach. I can do the resize approach, that will be cleaner. |
Done |
https://bugs.python.org/issue42128