Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-44353: Implement typing.NewType __call__ method in C#27262

Merged
ambv merged 17 commits into
python:mainpython/cpython:mainfrom
uriyyo:fix-issue-44353-faster-calluriyyo/cpython:fix-issue-44353-faster-callCopy head branch name to clipboard
Jul 22, 2021
Merged

bpo-44353: Implement typing.NewType __call__ method in C#27262
ambv merged 17 commits into
python:mainpython/cpython:mainfrom
uriyyo:fix-issue-44353-faster-calluriyyo/cpython:fix-issue-44353-faster-callCopy head branch name to clipboard

Conversation

@uriyyo

@uriyyo uriyyo commented Jul 20, 2021

Copy link
Copy Markdown
Member

@uriyyo

uriyyo commented Jul 20, 2021

Copy link
Copy Markdown
Member Author

@Fidget-Spinner Could you please review this PR?

Comment thread Modules/_functoolsmodule.c Outdated
@uriyyo uriyyo requested a review from JelleZijlstra July 20, 2021 15:59

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

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.

Comment thread Modules/_functoolsmodule.c Outdated
Comment thread Misc/NEWS.d/next/Library/2021-07-20-18-34-16.bpo-44353.ATuYq4.rst Outdated
uriyyo and others added 3 commits July 20, 2021 19:01
@uriyyo uriyyo requested a review from Fidget-Spinner July 20, 2021 16:05
@Fidget-Spinner Fidget-Spinner added the type-feature A feature request or enhancement label Jul 20, 2021
@JelleZijlstra

Copy link
Copy Markdown
Member

@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 operator actually makes the most sense.

Comment thread Misc/NEWS.d/next/Library/2021-07-20-18-34-16.bpo-44353.ATuYq4.rst Outdated
@uriyyo

uriyyo commented Jul 20, 2021

Copy link
Copy Markdown
Member Author

@JelleZijlstra Yup, I agree - operator is better place for such helper

@uriyyo uriyyo requested a review from JelleZijlstra July 20, 2021 17:42
@Fidget-Spinner Fidget-Spinner removed the request for review from rhettinger July 21, 2021 10:33

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

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.

Comment thread Modules/_operator.c Outdated
Comment thread Modules/_operator.c Outdated
Comment thread Modules/_operator.c Outdated
Co-authored-by: Denis Laxalde <denis@laxalde.org>
@uriyyo

uriyyo commented Jul 22, 2021

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@corona10: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from corona10 July 22, 2021 08:37
@Fidget-Spinner

Fidget-Spinner commented Jul 22, 2021

Copy link
Copy Markdown
Member

@Fidget-Spinner do we need backport it to python 3.10?

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.

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

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.

py_statistics = import_helper.import_fresh_module('statistics',

@bedevere-bot

Copy link
Copy Markdown

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. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@uriyyo

uriyyo commented Jul 22, 2021

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@corona10: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from corona10 July 22, 2021 16:26

@corona10 corona10 left a comment

Copy link
Copy Markdown
Member

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 ambv merged commit 96c4cbd into python:main Jul 22, 2021
@bedevere-bot

Copy link
Copy Markdown

@ambv: Please replace # with GH- in the commit message next time. Thanks!

@ambv

ambv commented Jul 22, 2021

Copy link
Copy Markdown
Contributor

Thanks, @uriyyo!

@pablogsal

Copy link
Copy Markdown
Member

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

Ran 367 tests in 0.198s
OK (skipped=1)
.
test_typing leaked [220, 220, 220] references, sum=660
test_typing leaked [69, 68, 68] memory blocks, sum=205
1 test failed again:
    test_typing
== Tests result: FAILURE then FAILURE ==

Per our buildbot policy, if a fix is not performed in 24 h we will need to revert

@uriyyo

uriyyo commented Jul 23, 2021

Copy link
Copy Markdown
Member Author

@pablogsal Looks like this because of this line

Py_INCREF(x);

I will open PR to fix it.

UPD: that no problem of a memory leak

UPD: Root cause of memory leak - #27305 (comment)

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

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.