New submission from Antoine Pitrou <pit...@free.fr>: This is an implementation of the idea suggested in: http://mail.python.org/pipermail/python-dev/2003-February/033445.html
The patch creates a dictionary of reentrant locks keyed by module full name. Trying to import a module or package will first get the lock for that module (or, if necessary, create it) and then acquire it. This is done for any module type. The global import lock is still there, but only used for two things: - serializing first time creation of module-specific locks - protection of imports based on import hooks, since we don't know whether third-party import hooks are themselves thread-safe Semantics of the public C API are unchanged, because it is not clear whether they should be or not (concerns of usefulness vs. compatibility). For example, PyImport_ImportModuleNoBlock() still uses the global import lock but this could be relaxed in a later patch. ---------- components: Interpreter Core files: implock.patch keywords: patch messages: 110287 nosy: brett.cannon, christian.heimes, grahamd, gvanrossum, ncoghlan, pitrou priority: normal severity: normal status: open title: A finer grained import lock type: feature request versions: Python 3.2 Added file: http://bugs.python.org/file17998/implock.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9260> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com