ifcopenshell.stream - fix garbage collection errors

Mentioined in #5457

Errors such as:
Exception ignored in: <function file.__del__ at 0x7f4cfcc9f920>
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/ifcopenshell/file.py", line 284, in __del__
    del file_dict[self.file_pointer()]
                  ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/ifcopenshell/file.py", line 444, in __getattr__
    return getattr(self.wrapped_data, attr)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'file_pointer'
This commit is contained in:
Andrej730
2024-09-23 19:10:32 +05:00
parent 08bba92b2e
commit fe1dff0191
@@ -284,6 +284,10 @@ try:
return True
return False
def __del__(self) -> None:
# Override to avoid clean up unrelated to stream file.
pass
class stream_entity(entity_instance):
def __init__(self, id: int, ifc_class: str, file: stream = None):
if not ifc_class: