[tor-commits] [bridgedb/master] Fix next item iteration

phw at torproject.org phw at torproject.org
Wed Feb 19 18:26:37 UTC 2020


commit bd2ee8d0fca1ab311f9644ff826a430b30234453
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Jan 11 16:26:19 2020 -0800

    Fix next item iteration
    
    Python 3.x replaced the generator's next() method with a next() builtin...
    
      https://stackoverflow.com/questions/21622193/python-3-2-coroutine-attributeerror-generator-object-has-no-attribute-next
    
    No significant difference in test outcome...
    
      before: FAILED (skips=106, failures=16, errors=273, successes=409)
      after:  FAILED (skips=106, failures=16, errors=272, successes=410)
---
 bridgedb/Storage.py              | 2 +-
 bridgedb/test/test_parse_addr.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bridgedb/Storage.py b/bridgedb/Storage.py
index c7385ba..9e2be8e 100644
--- a/bridgedb/Storage.py
+++ b/bridgedb/Storage.py
@@ -362,7 +362,7 @@ class DBGeneratorContextManager(_GeneratorContextManager):
         """
         if type is None:
             try:
-                self.gen.next()
+                next(self.gen)
             except StopIteration:
                 return
             return
diff --git a/bridgedb/test/test_parse_addr.py b/bridgedb/test/test_parse_addr.py
index 8183167..41cbb94 100644
--- a/bridgedb/test/test_parse_addr.py
+++ b/bridgedb/test/test_parse_addr.py
@@ -700,7 +700,7 @@ class PortListTest(unittest.TestCase):
         portList = addr.PortList(*ports)
         iterator = iter(portList)
         for x in range(len(ports)):
-            self.assertIn(iterator.next(), portList)
+            self.assertIn(next(iterator), portList)
 
     def test_str(self):
         """Test creating a :class:`addr.PortList` with valid ports.





More information about the tor-commits mailing list