1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-05-25 10:18:45 +00:00

fix(core): propagate exceptions via unimport.__exit__

[no changelog]
This commit is contained in:
Roman Zeyde 2025-05-02 10:45:47 +03:00
parent c6dedea7b3
commit d3df16e84e

View File

@ -107,7 +107,10 @@ class unimport:
self.mods = None self.mods = None
gc.collect() gc.collect()
if __debug__ and exc_type is not SystemExit: # If an exception is being handled here, `check_free_heap()` will fail
# (since the exception survives `gc.collect()` call above).
# So we prefer to skip the check, in order to preserve the exception.
if __debug__ and exc_type is None:
self.free_heap = check_free_heap(self.free_heap) self.free_heap = check_free_heap(self.free_heap)