[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/develop] Fix exception catching syntax



commit 39fd0a30d9f912908da2d9f9528fcd69b7bad8f3
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Fri Jan 10 14:03:23 2020 -0800

    Fix exception catching syntax
    
    Python 3.x deprecated old exception syntax...
    
      before: "except ValueError, exc:"
      after:  "except ValueError as exc:"
    
    This didn't change the test outcome...
    
      before: FAILED (skips=1, failures=7, errors=49, successes=255)
      after:  FAILED (skips=1, failures=7, errors=49, successes=255)
---
 bridgedb/Storage.py                     | 2 +-
 bridgedb/test/test_parse_descriptors.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bridgedb/Storage.py b/bridgedb/Storage.py
index 4182c4b..3cc6c09 100644
--- a/bridgedb/Storage.py
+++ b/bridgedb/Storage.py
@@ -374,7 +374,7 @@ class DBGeneratorContextManager(GeneratorContextManager):
             try:
                 self.gen.throw(type, value, traceback)
                 raise RuntimeError("generator didn't stop after throw()")
-            except StopIteration, exc:
+            except StopIteration as exc:
                 # Suppress the exception *unless* it's the same exception that
                 # was passed to throw().  This prevents a StopIteration
                 # raised inside the "with" statement from being suppressed
diff --git a/bridgedb/test/test_parse_descriptors.py b/bridgedb/test/test_parse_descriptors.py
index df7f34f..7fd7582 100644
--- a/bridgedb/test/test_parse_descriptors.py
+++ b/bridgedb/test/test_parse_descriptors.py
@@ -28,7 +28,7 @@ try:
     from stem.descriptor.extrainfo_descriptor import RelayExtraInfoDescriptor
     from stem.descriptor.router_status_entry import RouterStatusEntryV3
     from bridgedb.parse import descriptors
-except (ImportError, NameError), error:
+except (ImportError, NameError) as error:
     print("There was an error importing stem: %s" % error)
 else:
     HAS_STEM = True



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits