From abe51b93a860786609ad602012ffdb29b6f04075 Mon Sep 17 00:00:00 2001 From: matejcik Date: Mon, 2 Sep 2024 13:59:45 +0200 Subject: [PATCH] fix(python): prevent accidental modification of models.TREZORS --- python/.changelog.d/+4afd8b1d.fixed | 1 + python/src/trezorlib/models.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 python/.changelog.d/+4afd8b1d.fixed diff --git a/python/.changelog.d/+4afd8b1d.fixed b/python/.changelog.d/+4afd8b1d.fixed new file mode 100644 index 0000000000..d10815d33a --- /dev/null +++ b/python/.changelog.d/+4afd8b1d.fixed @@ -0,0 +1 @@ +Use `frozenset` for `models.TREZORS` to prevent accidental modification. diff --git a/python/src/trezorlib/models.py b/python/src/trezorlib/models.py index 2fde03eb2d..b1d638a6fd 100644 --- a/python/src/trezorlib/models.py +++ b/python/src/trezorlib/models.py @@ -109,7 +109,7 @@ TREZOR_SAFE5 = T3T1 TREZOR_DISC1 = DISC1 TREZOR_DISC2 = DISC2 -TREZORS = {T1B1, T2T1, T2B1, T3T1, T3B1, DISC1, DISC2} +TREZORS = frozenset({T1B1, T2T1, T2B1, T3T1, T3B1, DISC1, DISC2}) def by_name(name: Optional[str]) -> Optional[TrezorModel]: