Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3104)

#9260: A finer grained import lock

Can't Edit
Can't Publish+Mail
Start Review
Created:
1 year, 4 months ago by pitrou
Modified:
1 year ago
Reviewers:
neologix, martin
CC:
gvanrossum, loewis, brett.cannon, Nick Coghlan, sasha, AntoinePitrou, haypo, christian.heimes, Graham.Dumpleton_gmail.com, Arfrever.FTA_GMail.Com, asvetlov, Charles-François Natali, devnull_psf.upfronthosting.co.za, eric.snow
Visibility:
Public.

Patch Set 1 #

Patch Set 2 #

Total comments: 6

Patch Set 3 #

Total comments: 2

Patch Set 4 #

Patch Set 5 #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/importlib/_bootstrap.py View 7 chunks +178 lines, -13 lines 0 comments Download
Lib/importlib/test/test_locks.py View 3 4 1 chunk +115 lines, -0 lines 0 comments Download
Lib/pydoc.py View 1 chunk +1 line, -1 line 0 comments Download
Lib/test/lock_tests.py View 2 chunks +11 lines, -1 line 0 comments Download
Lib/test/test_pkg.py View 1 chunk +2 lines, -0 lines 0 comments Download
Lib/test/test_threaded_import.py View 3 chunks +17 lines, -2 lines 0 comments Download
Lib/token.py View 1 chunk +1 line, -1 line 0 comments Download
Python/import.c View 1 2 3 7 chunks +41 lines, -47 lines 0 comments Download

Messages

Total messages: 5
neologix_free.fr
Sorry for the delay, forgot about this one. This version looks safe (apart from the ...
1 year, 3 months ago #1
AntoinePitrou
> This version looks safe (apart from the limitation documented in the code that > ...
1 year, 3 months ago #2
AntoinePitrou
http://bugs.python.org/review/9260/diff/3916/12928 File Python/import.c (right): http://bugs.python.org/review/9260/diff/3916/12928#newcode153 Python/import.c:153: init_import_lock(lock); On 2012/02/18 13:04:52, Charles-François Natali wrote: > Shouldn't ...
1 year, 3 months ago #3
loewis
http://bugs.python.org/review/9260/diff/4829/17079 File Lib/importlib/_bootstrap.py (right): http://bugs.python.org/review/9260/diff/4829/17079#newcode1115 Lib/importlib/_bootstrap.py:1115: lock.acquire() Why does that not do deadlock avoidance? I ...
1 year ago #4
AntoinePitrou
1 year ago #5
http://bugs.python.org/review/9260/diff/4829/17079
File Lib/importlib/_bootstrap.py (right):

http://bugs.python.org/review/9260/diff/4829/17079#newcode1115
Lib/importlib/_bootstrap.py:1115: lock.acquire()
On 2012/05/05 22:11:16, loewis wrote:
> Why does that not do deadlock avoidance? I still fail to understand how the
> deadlock avoidance mechanism actually affects the importing. I.e. what
precisely
> happens when you run into a deadlock to the import that is in progress?

Deadlock avoidance is done in _lock_unlock_module(), which is invoked when a
module object is already present in sys.modules.

When a deadlock is detected, the module lock is simply not taken, meaning that
the thread sees an incomplete module, exactly like in other circular imports.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7