1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-27 08:38:07 +00:00

python/debuglink: properly clean up at end of "with client"

This commit is contained in:
matejcik 2020-02-11 11:29:47 +01:00
parent c14429c445
commit 7a253a6c0b

View File

@ -316,8 +316,7 @@ class TrezorClientDebugLink(TrezorClient):
self.in_with_statement -= 1 self.in_with_statement -= 1
# Clear input flow. # Clear input flow.
self.set_input_flow(None) try:
if _type is not None: if _type is not None:
# Another exception raised # Another exception raised
return False return False
@ -326,14 +325,16 @@ class TrezorClientDebugLink(TrezorClient):
# no need to check anything else # no need to check anything else
return False return False
# return isinstance(value, TypeError)
# Evaluate missed responses in 'with' statement # Evaluate missed responses in 'with' statement
if self.current_response < len(self.expected_responses): if self.current_response < len(self.expected_responses):
self._raise_unexpected_response(None) self._raise_unexpected_response(None)
finally:
# Cleanup # Cleanup
self.set_input_flow(None)
self.expected_responses = None self.expected_responses = None
self.current_response = None self.current_response = None
self.ui.pin = None
return False return False