Commit message · Roman Zeydefix(python): fix `trezorctl get-session` for legacy
`TrezorConnection._version` wasn't set, so the command was failing with:
```
Traceback (most recent call last):
File "./venv/bin/trezorctl", line 8, in <module>
sys.exit(cli())
^^^^^
File "./venv/lib/python3.12/site-packages/click/core.py", line 1161, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "./venv/lib/python3.12/site-packages/click/core.py", line 1082, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/rzeyde/src/trezor-firmware/python/src/trezorlib/cli/trezorctl.py", line 161, in invoke
return super().invoke(ctx)
^^^^^^^^^^^^^^^^^^^
File "./venv/lib/python3.12/site-packages/click/core.py", line 1697, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "./venv/lib/python3.12/site-packages/click/core.py", line 1443, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "./venv/lib/python3.12/site-packages/click/core.py", line 788, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "./venv/lib/python3.12/site-packages/click/decorators.py", line 45, in new_func
return f(get_current_context().obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/rzeyde/src/trezor-firmware/python/src/trezorlib/cli/trezorctl.py", line 361, in get_session
if obj.features.model == "1" and obj.version < (1, 9, 0):
^^^^^^^^^^^
File "/home/rzeyde/src/trezor-firmware/python/src/trezorlib/cli/__init__.py", line 280, in version
if self._version is None:
^^^^^^^^^^^^^
AttributeError: 'TrezorConnection' object has no attribute '_version'. Did you mean: 'version'?
```
[no changelog]
85/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context
AI analysis · Informational 20/100This is a straightforward bug fix in the Python command-line tool `trezorctl`. A missing internal variable (`_version`) caused the `get-session` subcommand to crash with an error when used with older (legacy) Trezor devices. The patch adds the missing variable declaration and resets it when the connection closes. There is no security vulnerability here—just a broken feature being repaired.