We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 95ecf2a commit fd3c321Copy full SHA for fd3c321
importlib_metadata/__init__.py
@@ -802,6 +802,7 @@ class FastPath:
802
True
803
"""
804
805
+ # The following cache is cleared at fork, see os.register_at_fork below
806
@functools.lru_cache() # type: ignore[misc]
807
def __new__(cls, root):
808
return super().__new__(cls)
@@ -842,6 +843,10 @@ def mtime(self):
842
843
def lookup(self, mtime):
844
return Lookup(self)
845
846
+# Clear FastPath.__new__ cache when forked, avoids trying to re-useing open
847
+# file pointers from zipp.Path/zipfile.Path objects in forked process
848
+os.register_at_fork(after_in_child=FastPath.__new__.cache_clear)
849
+
850
851
class Lookup:
852
0 commit comments