diff options
| author | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-17 12:06:44 +0200 |
|---|---|---|
| committer | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-17 12:06:44 +0200 |
| commit | 444b8a182b5a690fdb3e4d28ca8a61de27949178 (patch) | |
| tree | ba0f608b985a89c2a4baee4bc0e07cb461443092 /Python/import.c | |
| parent | f31fbd0341e56d6d7f729688befbc0edc9379802 (diff) | |
| parent | aa3eafec628637ab0369d1268934eb6201cf32d1 (diff) | |
| download | cpython-444b8a182b5a690fdb3e4d28ca8a61de27949178.tar.gz | |
Merge rephrasing with 3.3.
Diffstat (limited to 'Python/import.c')
| -rw-r--r-- | Python/import.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c index 2f71b97bc8..6882b57060 100644 --- a/Python/import.c +++ b/Python/import.c @@ -202,8 +202,11 @@ _PyImport_ReInitLock(void) if (import_lock_level > 1) { /* Forked as a side effect of import */ long me = PyThread_get_thread_ident(); - PyThread_acquire_lock(import_lock, 0); - /* XXX: can the previous line fail? */ + /* The following could fail if the lock is already held, but forking as + a side-effect of an import is a) rare, b) nuts, and c) difficult to + do thanks to the lock only being held when doing individual module + locks per import. */ + PyThread_acquire_lock(import_lock, NOWAIT_LOCK); import_lock_thread = me; import_lock_level--; } else { |
