[issue18122] RuntimeError: not holding the import lock

Richard Oudkerk report at bugs.python.org
Mon Jun 3 12:24:43 CEST 2013


Richard Oudkerk added the comment:

Forking as a side effect of importing a module is evil.  I think raising a RuntimeError is preferable to trying to make it Just Work.

But maybe one could do

    void
    _PyImport_ReInitLock(void)
    {
        if (import_lock != NULL) {
            import_lock = PyThread_allocate_lock();
            PyThread_acquire_lock(import_lock, WAIT_LOCK);
        }
        import_lock_thread = PyThread_get_thread_ident();
        _PyImport_ReleaseLock();
    }

----------
nosy: +sbt

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18122>
_______________________________________


More information about the Python-bugs-list mailing list