Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions kconfiglib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,10 +1087,10 @@ def _init(self, filename, warn, warn_to_stderr, encoding):
self.top_node.next = None
except UnicodeDecodeError as e:
_decoding_error(e, self.filename)

# Close the top-level Kconfig file. __self__ fetches the 'file' object
# for the method.
self._readline.__self__.close()
finally:
# Close the top-level Kconfig file. __self__ fetches the 'file' object
# for the method.
self._readline.__self__.close()

self._parsing_kconfigs = False

Expand Down Expand Up @@ -2984,8 +2984,10 @@ def _parse_block(self, end_token, parent, prev):

for filename in filenames:
self._enter_file(filename)
prev = self._parse_block(None, parent, prev)
self._leave_file()
try:
prev = self._parse_block(None, parent, prev)
finally:
self._leave_file()

elif t0 is end_token:
# Reached the end of the block. Terminate the final node and
Expand Down