Took about 6 hours to fix two ResourceWarnings in my test suite where I failed t...
Andrew Dalke @dalke@toots.nu
Took about 6 hours to fix two ResourceWarnings in my test suite where I failed to close an open file.
The first due to wrongly doing input validation between opening the file and using a context manager.
The second from a helper function to load a dataset from a file. I forgot that the file can be memory-mapped, so needs an explicit close.
I started adding close() and a context manger, but the ownership rules felt ungainly and error-prone.
Then realized the solution was 'allow_mmap=False'.