From ea16d3c42a62a8b2fc8674743ce8960d945931a5 Mon Sep 17 00:00:00 2001 From: matejcik Date: Wed, 5 Dec 2018 16:51:33 +0100 Subject: [PATCH] client: fix short-circuited ping (it's using call_raw so it must open its own session) --- trezorlib/client.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/trezorlib/client.py b/trezorlib/client.py index ac153f648..fc4f5d55b 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -223,7 +223,12 @@ class TrezorClient: # raise an exception if the firmware is too old. # So we short-circuit the simplest variant of ping with call_raw. if not button_protection and not pin_protection and not passphrase_protection: - return self.call_raw(messages.Ping(message=msg)) + # XXX this should be: `with self:` + try: + self.open() + return self.call_raw(messages.Ping(message=msg)) + finally: + self.close() msg = messages.Ping( message=msg,