mercurial/repoview.py
branchstable
changeset 47010 76ae43d5b1db
parent 47009 42eb8b7881b8
child 47011 b7e623ac98b6
--- a/mercurial/repoview.py	Sat Apr 24 15:46:39 2021 +0200
+++ b/mercurial/repoview.py	Fri Apr 23 18:30:53 2021 +0200
@@ -472,12 +472,15 @@
 
 def newtype(base):
     """Create a new type with the repoview mixin and the given base class"""
-    cls = _filteredrepotypes.get(base)
-    if cls is not None:
-        return cls
+    ref = _filteredrepotypes.get(base)
+    if ref is not None:
+        cls = ref()
+        if cls is not None:
+            return cls
 
     class filteredrepo(repoview, base):
         pass
 
-    _filteredrepotypes[base] = filteredrepo
+    _filteredrepotypes[base] = weakref.ref(filteredrepo)
+    # do not reread from weakref to be 100% sure not to return None
     return filteredrepo