autodoc: fix ordering of class and static methods for groupwise
order
#13201
+40
−19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I don't have an issue yet (but I'll create one and update the changelog once I'm done) but I've found the issue while working on #13200.
Class and static methods were meant to be ordered before regular methods when using
groupwise
order but this was not respected until now. The reason is that we callsort_members
before callinggenerate
(which is fine). However,generate()
actually callsimport_object
which itself modifiesmember_order
(because that's the first time we have the actual object and we can inspect it without relying on static analysis).So, we need to decouple
import_object
fromgenerate
. To avoid breaking stuff for now, I've added a private_generate()
method which is the actual implementation ofgenerate()
so that I can call it separately. Current uses ofgenerate()
remain the same.