-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
bpo-44353: Implement typing.NewType __call__ method in C #27262
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
Conversation
@Fidget-Spinner Could you please review this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but maybe we should wait for the functools maintainers in case they don't want it in that module.
Also, thanks a bunch for reviewing this too Jelle :). It's nice to have more reviewers around for typing.
Misc/NEWS.d/next/Library/2021-07-20-18-34-16.bpo-44353.ATuYq4.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
@Fidget-Spinner feel free to request my review on other typing PRs! I don't have a strong opinion on where to put the helper function. I feel like |
Misc/NEWS.d/next/Library/2021-07-20-18-34-16.bpo-44353.ATuYq4.rst
Outdated
Show resolved
Hide resolved
@JelleZijlstra Yup, I agree - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG. I removed Raymond from the reviewer list since this doesn't touch functools anymore.
Co-authored-by: Denis Laxalde <denis@laxalde.org>
I have made the requested changes; please review again |
Thanks for making the requested changes! @corona10: please review the changes made to this pull request. |
Probably not. Usually only doc/bugfixes can be backported. Performance improvements are usually not backported, unless the old version has performance that was so bad it caused a security vulnerability/bug/crash (e.g. regex DOS). We are too late into the 3.10 dev cycle to backport an improvement. Also, thinking abit more, @corona10 is right about adding a separate module for this. I know I've said before that we should be conservative about adding more typing stuff in C, but if it's a small simple optimization like the current PR (which doesn't break compatibility with things like PyPy), I'm +1. In case we need to add more things in the future, it's better to create a new module now and not pollute the other modules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once you added the accelerated module, you have to carefully manage both versions.
To manage the identical implementation within different languages, you should update unit tests to run both versions.
Please refer how other modules did.
cpython/Lib/test/test_statistics.py
Line 182 in c05a790
py_statistics = import_helper.import_fresh_module('statistics', |
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
I have made the requested changes; please review again |
Thanks for making the requested changes! @corona10: please review the changes made to this pull request. |
…ter-call # Conflicts: # Lib/test/test_typing.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM about module architecture.
Now I am turning over reviews to typing module experts
@ambv: Please replace |
Thanks, @uriyyo! |
This PR was introduced reference leaks and currently all refleak buildbots are red: Example: https://buildbot.python.org/all/#/builders/205/builds/102/steps/5/logs/stdio
Per our buildbot policy, if a fix is not performed in 24 h we will need to revert |
@pablogsal Looks like this because of this line cpython/Modules/_typingmodule.c Line 26 in 17575f7
I will open PR to fix it. UPD: that no problem of a memory leak UPD: Root cause of memory leak - #27305 (comment) |
https://bugs.python.org/issue44353