1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-26 16:18:22 +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,24 +316,25 @@ 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:
# Another exception raised
return False
if _type is not None: if self.expected_responses is None:
# Another exception raised # no need to check anything else
return False return False
if self.expected_responses is None: # Evaluate missed responses in 'with' statement
# no need to check anything else if self.current_response < len(self.expected_responses):
return False self._raise_unexpected_response(None)
# return isinstance(value, TypeError) finally:
# Evaluate missed responses in 'with' statement # Cleanup
if self.current_response < len(self.expected_responses): self.set_input_flow(None)
self._raise_unexpected_response(None) self.expected_responses = None
self.current_response = None
# Cleanup self.ui.pin = None
self.expected_responses = None
self.current_response = None
return False return False