-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-142651: Make call_count of Mock thread safe #142656
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
base: main
Are you sure you want to change the base?
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
758084c to
816a404
Compare
76816a8 to
29578a9
Compare
Misc/NEWS.d/next/Library/2025-12-13-06-17-44.gh-issue-142651.ZRtBu4.rst
Outdated
Show resolved
Hide resolved
…RtBu4.rst Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…into fix-issue-142651
fb7eab9 to
8e2348c
Compare
picnixz
left a comment
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.
| import concurrent.futures | ||
|
|
||
| from test.support import threading_helper | ||
| from test.support import setswitchinterval, threading_helper |
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.
This makes me think that we should have this as a context manager instead but this is a separate issue. I'll do it tomorrow myself.
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.
Do you want to do it in a separate PR? I can create a new PR for context manager.
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.
Thank you but I will need to check if it'll be useful in much places and whether it could create conflicts with backports (usually refactoring and new features in tests are annoying because it creates differences with older branches).
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.
Thank you, I think adding a context manager would be a good practice for me to learn and involve more in CPython development. Do you mind me giving it a try? Is there a sample PR you would like me to follow? How would you evaluate it being useful? (Like will be used in more than x places?)
also, do we need to back port this change to older versions? If so, may I also give it a try? Is there any pending steps before we want to merge this PR? (Saw that you have requested a review from @cjw296 , assuming that is the next step?)
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.
Maybe I was not clear but I want to investigate on my side first. If we were to do it, this could be an easy task but I do not want to create an issue or a PR unless I see whether it will be really useful.
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.
As for backporting this PR here, we have an automated way to do it. If the backport fails you can do a manual one later
gh-142651: Make call_count of Mock thread safe