File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -875,10 +875,10 @@ cdef class BlockValuesRefs:
875
875
data.
876
876
"""
877
877
cdef:
878
- public object referenced_blocks
878
+ public list referenced_blocks
879
879
880
880
def __cinit__(self , blk: SharedBlock ) -> None:
881
- self.referenced_blocks = weakref.WeakSet([ blk])
881
+ self.referenced_blocks = [ weakref.ref( blk)]
882
882
883
883
def add_reference(self , blk: SharedBlock ) -> None:
884
884
"""Adds a new reference to our reference collection.
@@ -888,7 +888,7 @@ cdef class BlockValuesRefs:
888
888
blk: SharedBlock
889
889
The block that the new references should point to.
890
890
"""
891
- self.referenced_blocks.add( blk )
891
+ self.referenced_blocks.append(weakref.ref( blk ) )
892
892
893
893
def has_reference(self ) -> bool:
894
894
"""Checks if block has foreign references.
@@ -900,5 +900,8 @@ cdef class BlockValuesRefs:
900
900
-------
901
901
bool
902
902
"""
903
+ self.referenced_blocks = [
904
+ ref for ref in self .referenced_blocks if ref() is not None
905
+ ]
903
906
# Checking for more references than block pointing to itself
904
907
return len(self.referenced_blocks ) > 1
You can’t perform that action at this time.
0 commit comments