◐ Shell
reader mode source ↗
Skip to content

bpo-30891: Fix importlib _find_and_load() race condition#2646

Merged
vstinner merged 1 commit into
python:masterfrom
vstinner:importlib_module_lock
Jul 10, 2017
Merged

bpo-30891: Fix importlib _find_and_load() race condition#2646
vstinner merged 1 commit into
python:masterfrom
vstinner:importlib_module_lock

Conversation

@vstinner

Copy link
Copy Markdown
Member
  • Rewrite importlib _get_module_lock(): it is now responsible to hold
    the imp lock directly.
  • _find_and_load() now holds the module lock to check if name is in
    sys.modules to prevent a race condition

@vstinner

Copy link
Copy Markdown
Member Author

I confirm with my Windows VM that "./python -m test -R 3:100 -m test_concurrency test_import" doesn't fail anymore with this change.

@serhiy-storchaka serhiy-storchaka 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.

Hide comment

LGTM except one outdated sentence.

@vstinner vstinner requested review from brettcannon and ncoghlan July 10, 2017 16:26
* Rewrite importlib _get_module_lock(): it is now responsible to hold
  the imp lock directly.
* _find_and_load() now holds the module lock to check if name is in
  sys.modules to prevent a race condition
@vstinner vstinner merged commit 4f9a446 into python:master Jul 10, 2017
@vstinner vstinner deleted the importlib_module_lock branch July 10, 2017 20:52
vstinner added a commit that referenced this pull request Jul 10, 2017
* Rewrite importlib _get_module_lock(): it is now responsible to hold
  the imp lock directly.
* _find_and_load() now holds the module lock to check if name is in
  sys.modules to prevent a race condition
(cherry picked from commit 4f9a446)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants