jamesls / semidbm

Cross platform (fast) DBM interface in python
Other
51 stars 13 forks source link

File not closed when verify_header fails #12

Open philmayes opened 6 years ago

philmayes commented 6 years ago

I need to convert dbhash because it's not supported in python3, so in python2 I:

This lets the conversion happen automagically in my db code, rather than needing explicit conversion. BUT the rename fails because the file has not been closed, so in mmapload.py I made the change:

        try:    # Phil added try...except
            header = f.read(8)
            self._verify_header(header)
        except:
            f.close()
            raise

I did not try to submit a change because it may be better wrapped in the other try clause.