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 4c6b9c1 commit cbc721bCopy full SHA for cbc721b
importlib_metadata/__init__.py
@@ -803,6 +803,7 @@ class FastPath:
803
True
804
"""
805
806
+ # The following cache is cleared at fork, see os.register_at_fork below
807
@functools.lru_cache() # type: ignore[misc]
808
def __new__(cls, root):
809
return super().__new__(cls)
@@ -843,6 +844,10 @@ def mtime(self):
843
844
def lookup(self, mtime):
845
return Lookup(self)
846
847
+# Clear FastPath.__new__ cache when forked, avoids trying to re-useing open
848
+# file pointers from zipp.Path/zipfile.Path objects in forked process
849
+os.register_at_fork(after_in_child=FastPath.__new__.cache_clear)
850
+
851
852
class Lookup:
853
0 commit comments