git/packwriter: open(..) prohibited in __del__
When an exception occurs, __del__ is invoked by the interpreter, to
perform cleanup. It seems that since Python 3.4, the behaviour has
changed, and also prohibits invocations of open(..) (source:
https://stackoverflow.com/a/
29737870). Instead, contextmanager API
should be used (source: https://stackoverflow.com/a/
26544629), which
seems to be in place already.
This should fix exception messages such as 'NameError: name 'open'
is not defined'.
Signed-off-by: Bas Stottelaar <basstottelaar@gmail.com>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>