Skip to content

FIX __init_subclass__ should call super()'s method #24854

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

Merged
merged 1 commit into from
Nov 8, 2022

Conversation

adrinjalali
Copy link
Member

After adding set_output CI on sample-props branch started to fail.

This was due to __init_subclass__ in _SetOutputMixin not calling super().__init_subclass__.

This PR adds the call, but there's a catch:

We cannot pass extra args to the parent's __init_subclass__, since the signature for object.__init_subclass__ doesn't accept any args. So by the time we get to calling that one, we should have emptied whatever's in kwargs.

Now the issue is if there's a third party developer having some parent class implementing a __init_subclass__ which accepts the same args as the ones we have in sklearn, things would break. The call chain therefore assumes there are no conflicts between the signatures.

cc @thomasjpfan @glemaitre @jnothman

@adrinjalali
Copy link
Member Author

Merging into sample-props since this fixes the CI. We can have a different solution on main if there are objections.

@thomasjpfan
Copy link
Member

We can have a different solution on main if there are objections.

I think this likely needs to be in main. I opened #24863 to place this fix on main with a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants