Python: Parse class bases like function arguments - #22301
maxfischer2781 wants to merge 6 commits into
Conversation
|
Good |
|
Hi. Thanks for your contribution; could you perhaps add some test cases as well? |
I can try. It's not really clear to me how the parser tests work. Do I see it correctly that in |
Yes, that looks like the right place to add the tests (example: #17822). |
|
@hvitved thanks for the pointers! Created, verified and added a test with expected output. This should cover just about all cases of expressions regularly used as class bases. |
hvitved
left a comment
There was a problem hiding this comment.
Code change looks plausible to me, but I would like someone from @github/codeql-python to confirm. Thanks again for the contribution.
tausbn
left a comment
There was a problem hiding this comment.
This looks good to me! Thank you for the contribution. ❤️
There are a few formalities that need to be taken care of (adding a change note and bumping the extractor version), but I can take care of that, and just tack the commits on to the end of the PR, and then we can merge it.
|
I have started a DCA run; we can merge once that comes back without issues. |
|
That's good thanks. |
|
@hvitved There's now a (minor) merge conflict due the rest of the codebase moving on. Should I take action or is this still on the way to being merged? |
|
Yes of you can take action. |
|
@maxfischer2781 : Feel free to resolve the merge conflict. @tausbn: Are you still planning on taking it from there? |
This PR adjusts how class bases are parsed to match the parsing of function arguments.
Previously, any node with a
valuefield was excluded to reject dict-splats as bases; this would also reject many other valid nodes, critically subscripts as used for typing (e.g.list[int]). Now, the undesired node types are explicitly rejected.Closes #22298.