svn commit: r346447 - user/ngie/bug-237403/tests/sys/opencrypto

Enji Cooper ngie at FreeBSD.org
Tue Sep 3 14:07:13 UTC 2019


Author: ngie
Date: Sat Apr 20 16:05:04 2019
New Revision: 346447
URL: https://svnweb.freebsd.org/changeset/base/346447

Log:
  Use py3 compatible method for catching exceptions
  
  Now ancient versions of python used to support catching exceptions in the form
  `except Exception, exception_object`. This support was removed in py3 (and
  introduced preemptively in earlier 2.x versions), being replaced by the form
  `except Exception as exception_object`.

Modified:
  user/ngie/bug-237403/tests/sys/opencrypto/cryptotest.py

Modified: user/ngie/bug-237403/tests/sys/opencrypto/cryptotest.py
==============================================================================
--- user/ngie/bug-237403/tests/sys/opencrypto/cryptotest.py	Sat Apr 20 16:01:04 2019	(r346446)
+++ user/ngie/bug-237403/tests/sys/opencrypto/cryptotest.py	Sat Apr 20 16:05:04 2019	(r346447)
@@ -113,7 +113,7 @@ def GenTestCase(cname):
                             cipherkey,
                             mac=self._gmacsizes[len(cipherkey)],
                             mackey=cipherkey, crid=crid)
-                    except EnvironmentError, e:
+                    except EnvironmentError as e:
                         # Can't test algorithms the driver does not support.
                         if e.errno != errno.EOPNOTSUPP:
                             raise
@@ -122,7 +122,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
@@ -142,7 +142,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
@@ -210,7 +210,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
@@ -309,7 +309,7 @@ def GenTestCase(cname):
                     try:
                         c = Crypto(mac=alg, mackey=key,
                             crid=crid)
-                    except EnvironmentError, e:
+                    except EnvironmentError as e:
                         # Can't test hashes the driver does not support.
                         if e.errno != errno.EOPNOTSUPP:
                             raise




More information about the svn-src-user mailing list