-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
bpo-31070: Fix a race condition in importlib _get_module_lock(). #3033
bpo-31070: Fix a race condition in importlib _get_module_lock(). #3033
Conversation
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, I just suggest to add a comment.
Lib/importlib/_bootstrap.py
Outdated
def cb(ref, name=name): | ||
_imp.acquire_lock() | ||
try: | ||
if _module_locks.get(name) is ref: |
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.
I suggest to add a comment on the test. Something like:
# bpo-31070: Check if another thread created a new lock
# after the previous lock was destroyed
# but before the weakref callback was called
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.
Done.
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, thanks for the 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.
Thanks @serhiy-storchaka!
pythonGH-3033). (cherry picked from commit 9b0d1d6)
GH-3038 is a backport of this pull request to the 3.6 branch. |
https://bugs.python.org/issue31070