Skip to content

Remove staticmethod.__new__ and classmethod.__new__ #6934

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
Jan 17, 2022

Conversation

JelleZijlstra
Copy link
Member

It's not clear from the stub why these exist; they just have *args/**kwargs and a generic signature.

Does anyone know of a good reason for these to be in the stub?

It's not clear from the stub why these exist; they just have *args/**kwargs and a generic signature.

Does anyone know of a good reason for these to be in the stub?
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we can do without them!

@JelleZijlstra
Copy link
Member Author

It was added in #1089.

At runtime it really does accept any args, but creates a useless object:

In [12]: cm=classmethod.__new__(classmethod, len, x=3); print(cm.__get__(int))
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-12-e2ad981a1fb1> in <module>
----> 1 cm=classmethod.__new__(classmethod, len, x=3); print(cm.__get__(int))

RuntimeError: uninitialized classmethod object

I don't know what that's good for and it doesn't seem important to reflect it in the stub.

@srittau srittau merged commit 01f3f8a into master Jan 17, 2022
@srittau srittau deleted the JelleZijlstra-patch-1 branch January 17, 2022 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants