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,8 +316,7 @@ 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
@ -326,14 +325,16 @@ class TrezorClientDebugLink(TrezorClient):
# no need to check anything else
return False
# return isinstance(value, TypeError)
# Evaluate missed responses in 'with' statement
if self.current_response < len(self.expected_responses):
self._raise_unexpected_response(None)
finally:
# Cleanup
self.set_input_flow(None)
self.expected_responses = None
self.current_response = None
self.ui.pin = None
return False