Message170320
Python 3.2 has extra code in _PyImport_ReInitLock() which means that when a fork happens as a side effect of an import, the main thread of the forked process owns the import lock. Therefore other threads in the forked process cannot import anything.
_PyImport_ReInitLock(void)
{
if (import_lock != NULL)
import_lock = PyThread_allocate_lock();
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? */
import_lock_thread = me;
import_lock_level--;
} else {
import_lock_thread = -1;
import_lock_level = 0;
}
}
I think the reason this code is not triggered in Python 3.3 is the introduction of per-module import locks. |
|
Date |
User |
Action |
Args |
2012-09-11 16:04:05 | sbt | set | recipients:
+ sbt, palmer |
2012-09-11 16:04:05 | sbt | set | messageid: <1347379445.35.0.563964880184.issue15914@psf.upfronthosting.co.za> |
2012-09-11 16:04:04 | sbt | link | issue15914 messages |
2012-09-11 16:04:04 | sbt | create | |
|