fix calling ctxt exits when Log.__enter__ fails
fix calling ctxt exits when Log.__enter__ fails

The following simplification of `Log` illustrates the issue:

    class Log(contextlib.ExitStack):
      def __enter__(self):
        self.enter_context(foo)
        ... # If an exception is raised here, `foo.__exit__` is not called.
        return super.__enter__()

This is fixed by adding an extra method, `Log._init_context(self, stack)`, that
is called in `Log.__enter__` to initialize the exit stack, wrapped in a `try
... except`:

    class Log():
      def __enter__(self):
        stack = contextlib.ExitStack()
        try:
          self._init_context(stack)
        except:
          stack.__exit__(*sys.exc_info())
        return self
      def _init_context(self, stack):
        ...

wijnandhoitinga/nutils,joostvanzwieten/nutils,nutils/nutils,CVerhoosel/nutils