When using ISyntax as a contextmanager and trying to open an unsupported file, libisyntax.open_from_registered_handle() will throw LibISyntaxFatalError, and when __exit__() calls close() there will be an AttributeError as closed has not yet been set. The same thing can likely happen if register_io() throws.
from isyntax import ISyntax
from isyntax.lowlevel.libisyntax import LibISyntaxFatalError
try:
with ISyntax.open("some non-isyntax file") as wsi:
pass
except LibISyntaxFatalError:
pass
Exception ignored in: <function ISyntax.__del__ at 0x00000156C209F4C0>
Traceback (most recent call last):
File "c:\work\notebooks\.venv311\Lib\site-packages\isyntax\wrapper.py", line 231, in __del__
self.close()
File "c:\work\notebooks\.venv311\Lib\site-packages\isyntax\wrapper.py", line 96, in close
if self.closed:
^^^^^^^^^^^
AttributeError: 'ISyntax' object has no attribute 'closed'
Hi,
When using ISyntax as a contextmanager and trying to open an unsupported file,
libisyntax.open_from_registered_handle()
will throwLibISyntaxFatalError
, and when__exit__()
callsclose()
there will be anAttributeError
asclosed
has not yet been set. The same thing can likely happen ifregister_io()
throws.