Code Generator: Use context manager to read FDL files
Feature objects are currently instantiated like this:
# bad
SiLAServiceFeature = Feature(open(join(dirname(__file__), "SiLAService.sila.xml")).read())
This can leads to a race condition when the garbage collector didn't close the file handle in time, observable as ResourceWarning: unclosed file.
Solution: Use a context manager to close the file immediately
# good
with open(join(dirname(__file__), "SiLAService.sila.xml")).read() as fdl_file:
SiLAServiceFeature = Feature(fdl_file.read())
(Reported by @track02 via Slack, thank you)
Edited by Niklas Mertsch