@@ -65,7 +65,7 @@ class SmokeTest(unittest.TestCase):
blob = self.client.seal(self.root_key, data, auth, None)
try:
result = self.client.unseal(self.root_key, blob, auth[:-1] + 'B', None)
- except ProtocolError, e:
+ except ProtocolError(e):
rc = e.rc
self.assertEqual(rc, tpm2.TPM2_RC_AUTH_FAIL)
@@ -119,7 +119,7 @@ class SmokeTest(unittest.TestCase):
self.client.policy_password(handle)
result = self.client.unseal(self.root_key, blob, auth, handle)
- except ProtocolError, e:
+ except ProtocolError(e):
rc = e.rc
self.client.flush_context(handle)
except:
@@ -136,7 +136,7 @@ class SmokeTest(unittest.TestCase):
rc = 0
try:
blob = self.client.seal(self.root_key, data, auth, None)
- except ProtocolError, e:
+ except ProtocolError(e):
rc = e.rc
self.assertEqual(rc, tpm2.TPM2_RC_SIZE)
@@ -152,7 +152,7 @@ class SmokeTest(unittest.TestCase):
0xDEADBEEF)
self.client.send_cmd(cmd)
- except IOError, e:
+ except IOError(e):
rejected = True
except:
pass
@@ -212,7 +212,7 @@ class SmokeTest(unittest.TestCase):
self.client.tpm.write(cmd)
rsp = self.client.tpm.read()
- except IOError, e:
+ except IOError(e):
# read the response
rsp = self.client.tpm.read()
rejected = True
@@ -283,7 +283,7 @@ class SpaceTest(unittest.TestCase):
rc = 0
try:
space1.send_cmd(cmd)
- except ProtocolError, e:
+ except ProtocolError(e):
rc = e.rc
self.assertEqual(rc, tpm2.TPM2_RC_COMMAND_CODE |
I need more time to fix all the byte array / string related stuff but it makes sense to fix the exceptions as it is fairly mechanical procedure: 1,$s/except \(.*\), \(.*\):/except \1(\2):/g I.e. fix the low hanging fruit first and the rest later. Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> --- tools/testing/selftests/tpm2/tpm2_tests.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)