diff --git a/doxygen.py b/doxygen.py index 579b77cf8..5a1e46ca2 100644 --- a/doxygen.py +++ b/doxygen.py @@ -107,9 +107,8 @@ def DoxyfileParse(file_contents, conf_dir, data=None): if nextfile in data[key]: raise Exception("recursive @INCLUDE in Doxygen config: " + nextfile) data[key].append(nextfile) - fh = open(nextfile, "r") - DoxyfileParse(fh.read(), conf_dir, data) - fh.close() + with open(nextfile, "r") as fh: + DoxyfileParse(fh.read(), conf_dir, data) else: append_data(data, key, new_data, token) new_data = True