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