[issue30893] Expose importlib._bootstrap._ModuleLockManager in importlib.machinery

Nick Coghlan report at bugs.python.org
Mon Jul 10 21:22:17 EDT 2017


Nick Coghlan added the comment:

Based on https://github.com/python/cpython/pull/2646/files#r126574323, I'm actually thinking along different lines: I'm starting to think we should move the current sys.modules to sys._modules, and make sys.modules a synchronised wrapper that does the following for all get/set/delete operations:

  # Acquires the global import lock
  # Acquires the relevant module lock
  # Releases the global import lock
  # Mutates sys._modules
  # Releases the module lock

That said, I'm not sure that would be sufficient to give the desired level of atomicity, so exposing ModuleLockManager may actually be a better approach.

----------

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


More information about the Python-bugs-list mailing list