Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Apr 2019 04:50:03 +0000 (UTC)
From:      Enji Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r346623 - head/tests/sys/opencrypto
Message-ID:  <201904240450.x3O4o35q067300@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Wed Apr 24 04:50:03 2019
New Revision: 346623
URL: https://svnweb.freebsd.org/changeset/base/346623

Log:
  Chase PEP-3110
  
  Replace `except Environment, e:` with `except Environment as e` for
  compatibility between python 2.x and python 3.x.
  
  While here, fix a bad indentation change from r346620 by reindenting the code
  properly.
  
  MFC after:	2 months

Modified:
  head/tests/sys/opencrypto/cryptotest.py

Modified: head/tests/sys/opencrypto/cryptotest.py
==============================================================================
--- head/tests/sys/opencrypto/cryptotest.py	Wed Apr 24 04:45:00 2019	(r346622)
+++ head/tests/sys/opencrypto/cryptotest.py	Wed Apr 24 04:50:03 2019	(r346623)
@@ -124,7 +124,7 @@ def GenTestCase(cname):
                             mac=self._gmacsizes[len(cipherkey)],
                             mackey=cipherkey, crid=crid,
                             maclen=16)
-                    except EnvironmentError, e:
+                    except EnvironmentError as e:
                         # Can't test algorithms the driver does not support.
                         if e.errno != errno.EOPNOTSUPP:
                             raise
@@ -133,7 +133,7 @@ def GenTestCase(cname):
                     if mode == 'ENCRYPT':
                         try:
                             rct, rtag = c.encrypt(pt, iv, aad)
-                        except EnvironmentError, e:
+                        except EnvironmentError as e:
                             # Can't test inputs the driver does not support.
                             if e.errno != errno.EINVAL:
                                 raise
@@ -153,7 +153,7 @@ def GenTestCase(cname):
                         else:
                             try:
                                 rpt, rtag = c.decrypt(*args)
-                            except EnvironmentError, e:
+                            except EnvironmentError as e:
                                 # Can't test inputs the driver does not support.
                                 if e.errno != errno.EINVAL:
                                     raise
@@ -221,7 +221,7 @@ def GenTestCase(cname):
                     try:
                         c = Crypto(meth, cipherkey, crid=crid)
                         r = curfun(c, pt, iv)
-                    except EnvironmentError, e:
+                    except EnvironmentError as e:
                         # Can't test hashes the driver does not support.
                         if e.errno != errno.EOPNOTSUPP:
                             raise
@@ -252,7 +252,7 @@ def GenTestCase(cname):
                         mackey=key, maclen=16)
                     r, tag = Crypto.encrypt(c, payload,
                         nonce, aad)
-                except EnvironmentError, e:
+                except EnvironmentError as e:
                     if e.errno != errno.EOPNOTSUPP:
                         raise
                     continue
@@ -294,7 +294,7 @@ def GenTestCase(cname):
                         key=key,
                         mac=cryptodev.CRYPTO_AES_CCM_CBC_MAC,
                         mackey=key, maclen=16)
-                except EnvironmentError, e:
+                except EnvironmentError as e:
                     if e.errno != errno.EOPNOTSUPP:
                         raise
                     continue
@@ -388,13 +388,13 @@ def GenTestCase(cname):
 
                 for data in lines:
                     msg = data['Msg'].decode('hex')
-                                        msg = msg[:int(data['Len'])]
+                    msg = msg[:int(data['Len'])]
                     md = data['MD'].decode('hex')
 
                     try:
                         c = Crypto(mac=alg, crid=crid,
                             maclen=hashlen)
-                    except EnvironmentError, e:
+                    except EnvironmentError as e:
                         # Can't test hashes the driver does not support.
                         if e.errno != errno.EOPNOTSUPP:
                             raise
@@ -451,7 +451,7 @@ def GenTestCase(cname):
                     try:
                         c = Crypto(mac=alg, mackey=key,
                             crid=crid, maclen=hashlen)
-                    except EnvironmentError, e:
+                    except EnvironmentError as e:
                         # Can't test hashes the driver does not support.
                         if e.errno != errno.EOPNOTSUPP:
                             raise



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904240450.x3O4o35q067300>