Skip to content
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

Special-case setting __new__ in class #3102

merged 1 commit into from Aug 28, 2019


Copy link

Python special-cases the name __new__ in a class: if it's a Python function, it's automatically wrapped in a staticmethod:

>>> class X:
...     def __new__(cls): return object.__new__(cls)
>>> X.__dict__["__new__"]
<staticmethod object at 0x7f0d52eafb38>

This PR implements this feature for Cython functions.

@scoder scoder added this to the 3.0 milestone Aug 27, 2019
@jdemeyer jdemeyer marked this pull request as ready for review August 27, 2019 20:41
@scoder scoder merged commit 352c419 into cython:master Aug 28, 2019
@jdemeyer jdemeyer deleted the SetNewInClass branch August 28, 2019 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants