From b3aacf14859bf1eee6a920c1ac4953add86235ac Mon Sep 17 00:00:00 2001 From: M1nd3r Date: Mon, 26 Aug 2024 14:23:54 +0200 Subject: [PATCH] chore(core): add logging, update comments [no changelog] --- core/src/trezor/wire/__init__.py | 6 ++++++ core/src/trezor/wire/thp/pairing_context.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/trezor/wire/__init__.py b/core/src/trezor/wire/__init__.py index 14c9478833..38063f645f 100644 --- a/core/src/trezor/wire/__init__.py +++ b/core/src/trezor/wire/__init__.py @@ -91,6 +91,10 @@ if utils.USE_THP: # This is not done for the debug session because the snapshot taken # in a debug session would clear modules which are in use by the # workflow running on wire. + if __debug__: + log.debug( + __name__, "utils.unimport_end(modules) and loop.clear()" + ) utils.unimport_end(modules) loop.clear() return @@ -154,6 +158,8 @@ async def handle_session(iface: WireInterface, is_debug_session: bool = False) - if not do_not_restart: # Let the session be restarted from `main`. + if __debug__: + log.debug(__name__, "loop.clear()") loop.clear() return # pylint: disable=lost-exception diff --git a/core/src/trezor/wire/thp/pairing_context.py b/core/src/trezor/wire/thp/pairing_context.py index 2de90f48b9..1adde4ca84 100644 --- a/core/src/trezor/wire/thp/pairing_context.py +++ b/core/src/trezor/wire/thp/pairing_context.py @@ -134,7 +134,7 @@ class PairingContext(Context): except Exception as exc: # Log and try again. The session handler can only exit explicitly via - # loop.clear() above. + # loop.clear() above. # TODO not updated comments if __debug__: log.exception(__name__, exc)