Skip to content

File not closed when verify_header fails #12

@philmayes

Description

@philmayes

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

  • try to open as semidb
  • if fail, open as dbhash, copy keys to new-name, close, rename.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions