gh-98624 Add mutex to unittest.mock.NonCallableMock#98688
gh-98624 Add mutex to unittest.mock.NonCallableMock#98688cjw296 merged 8 commits intopython:mainfrom noah-weingarden:gh-98624-add-lock-to-unittest-mock
Conversation
Jason-Y-Z
left a comment
There was a problem hiding this comment.
Thanks for the PR.
I left a few comments from my side and please feel free to take them or leave them.
A more general question would be - do we have a way to automated-test this?
I've been thinking about that too. It's really hard to test because it's such a subtle race condition. The test I created in the minimal reproducible example for #98624 only consistently demonstrates the bug because I added synchronization directly inside the standard library. Without doing that, I believe any test would only fail non-deterministically rather than every time. Would it be ok to just add a link to the issue in the comments? Unless you or someone else can think of a way to test this bug consistently? |
|
Oops, I didn't realize re-requesting a review would remove the request for @cjw296! |
|
Thanks @noah-weingarden for the PR, and @cjw296 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
|
Thanks @noah-weingarden for the PR, and @cjw296 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10. |
…8688) * Added lock to NonCallableMock in unittest.mock * Add blurb * Nitpick blurb * Edit comment based on @Jason-Y-Z's review * Add link to GH issue (cherry picked from commit 0346edd) Co-authored-by: noah-weingarden <33741795+noah-weingarden@users.noreply.github.com>
|
GH-98797 is a backport of this pull request to the 3.11 branch. |
…8688) * Added lock to NonCallableMock in unittest.mock * Add blurb * Nitpick blurb * Edit comment based on @Jason-Y-Z's review * Add link to GH issue (cherry picked from commit 0346edd) Co-authored-by: noah-weingarden <33741795+noah-weingarden@users.noreply.github.com>
|
GH-98798 is a backport of this pull request to the 3.10 branch. |
|
@pablogsal - how far are we backporting bugfixes now? 3.6 onwards right? ;-) |
|
3.10 onwards unless it's security-related. |
|
Thanks for looking into this! :) |
|
@ambv - wow, for many of us, 3.10 is the "new shiny we're super excited about eventually moving on to"! |
* Added lock to NonCallableMock in unittest.mock * Add blurb * Nitpick blurb * Edit comment based on @Jason-Y-Z's review * Add link to GH issue
Closes #98624. I'm open to any and all feedback!
unittest.mock#98624