Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9b0d1d64
Commit
9b0d1d64
authored
Aug 09, 2017
by
Serhiy Storchaka
Committed by
GitHub
Aug 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-31070: Fix a race condition in importlib _get_module_lock(). (#3033)
parent
88eee44a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1491 additions
and
1475 deletions
+1491
-1475
Lib/importlib/_bootstrap.py
Lib/importlib/_bootstrap.py
+12
-2
Misc/NEWS.d/next/Core and Builtins/2017-08-09-09-40-54.bpo-31070.oDyLiI.rst
...ore and Builtins/2017-08-09-09-40-54.bpo-31070.oDyLiI.rst
+1
-0
Python/importlib.h
Python/importlib.h
+1478
-1473
No files found.
Lib/importlib/_bootstrap.py
View file @
9b0d1d64
...
...
@@ -172,8 +172,18 @@ def _get_module_lock(name):
lock
=
_DummyModuleLock
(
name
)
else
:
lock
=
_ModuleLock
(
name
)
def
cb
(
_
):
del
_module_locks
[
name
]
def
cb
(
ref
,
name
=
name
):
_imp
.
acquire_lock
()
try
:
# bpo-31070: Check if another thread created a new lock
# after the previous lock was destroyed
# but before the weakref callback was called.
if
_module_locks
.
get
(
name
)
is
ref
:
del
_module_locks
[
name
]
finally
:
_imp
.
release_lock
()
_module_locks
[
name
]
=
_weakref
.
ref
(
lock
,
cb
)
finally
:
_imp
.
release_lock
()
...
...
Misc/NEWS.d/next/Core and Builtins/2017-08-09-09-40-54.bpo-31070.oDyLiI.rst
0 → 100644
View file @
9b0d1d64
Fix a race condition in importlib _get_module_lock().
Python/importlib.h
View file @
9b0d1d64
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment