mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
#4220 weakref to file
This commit is contained in:
@@ -252,7 +252,11 @@ class file(object):
|
|||||||
self.future = []
|
self.future = []
|
||||||
self.transaction = None
|
self.transaction = None
|
||||||
|
|
||||||
file_dict[self.file_pointer()] = self
|
import weakref
|
||||||
|
file_dict[self.file_pointer()] = weakref.ref(self)
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
del file_dict[self.file_pointer()]
|
||||||
|
|
||||||
def set_history_size(self, size):
|
def set_history_size(self, size):
|
||||||
self.history_size = size
|
self.history_size = size
|
||||||
@@ -574,4 +578,4 @@ class file(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_pointer(v):
|
def from_pointer(v):
|
||||||
return file_dict.get(v)
|
return file_dict.get(v)()
|
||||||
|
|||||||
Reference in New Issue
Block a user