s4:scripting: Ensure generated error definition files are closed after use
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Wed, 10 Jan 2024 22:23:53 +0000 (11:23 +1300)
committerJoseph Sutton <jsutton@samba.org>
Mon, 15 Jan 2024 00:48:40 +0000 (00:48 +0000)
commit2e82159d0f65087af861027bf35544a1e26454ab
treef1d6db16ef557067badce59b5b4585431962bc30
parentedff07c7d6af8c6e5276198adad1ae14fef76506
s4:scripting: Ensure generated error definition files are closed after use

This helps to avoid warnings like this one:

/data/samba/source4/scripting/bin/gen_hresult.py:178: ResourceWarning: unclosed file <_io.TextIOWrapper name='/data/samba/bin/default/libcli/util/hresult.c' mode='w' encoding='UTF-8'>
  main()
ResourceWarning: Enable tracemalloc to get the object allocation traceback

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
source4/scripting/bin/gen_hresult.py