You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CompoundFileMiniStream.close being called twice leading to "Exception ignored" warnings in recent Python versions #14
Hi, thank you for the awesome project, it has recently been very useful to me and still works great at reading these old files. I think projects like these are very important.
with a recent Python (I have 3.13), will read the data correctly but a warning will be printed:
Exception ignored in: <compoundfiles.streams.CompoundFileMiniStream object at 0x719e7de27280>
Traceback (most recent call last):
File "/proj/.venv/lib/python3.13/site-packages/compoundfiles/streams.py", line 245, in close
AttributeError: 'NoneType' object has no attribute 'close'
I believe this is because the CompoundFileMiniStream.close function is being called twice
I believe the smallest fix it to also call the close() method in the base implementation, i.e.
importioclassMyTestClass(io.RawIOBase):
def__init__(self):
print("MyTestClass.__init__")
defclose(self):
super().close() # this is the fixprint("MyTestClass.close")
withMyTestClass() asd:
print("inside")
So, my suggestion would be to change the CompoundFileMiniStream.close function to:
defclose(self):
super().close() # add this linetry:
self._file.close()
finally:
self._file=None
Huh, I'd almost forgotten about this ol' project! The suggestion sounds reasonable -- could you stick that in a PR? I should really bump the packaging on this up to something vaguely modern at the same time...
Activity
vrzh commentedon Sep 1, 2026
For now I just monkey patch the
closefunction as follows:waveform80 commentedon Sep 17, 2026
Huh, I'd almost forgotten about this ol' project! The suggestion sounds reasonable -- could you stick that in a PR? I should really bump the packaging on this up to something vaguely modern at the same time...
Close `io.RawIOBase` base of `CompoundFileMiniStream` to prevent "exc…
vrzh commentedon Sep 28, 2026
Thanks! Created pull request #15. Sorry for the delay.