From bb2cba83c5a336d1b8e03b3cb31b5c6b81bfb7b8 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 17 May 2024 11:12:49 +0200 Subject: [PATCH] commands.py: Resolve possible variable use before assignment pySim/commands.py:608:39: E0606: Possibly using variable 'p2' before assignment (possibly-used-before-assignment) Let's raise an exception in the erroneous case. Change-Id: I23adf2e89aa8a13246cc20ef022c84f0113eb2cd --- pySim/commands.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pySim/commands.py b/pySim/commands.py index 08537bd3..7b21fafd 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -606,6 +606,8 @@ class SimCardCommands: p2 = '81' elif context == 'gsm': p2 = '80' + else: + raise ValueError("Unsupported context '%s'" % context) (data, sw) = self.send_apdu_constr_checksw( self.cla_byte, '88', '00', p2, AuthCmd3G, cmd_data, AuthResp3G) if 'auts' in data: