bundle2: look for __next__ as well as next to identify iterators
authorAugie Fackler <augie@google.com>
Mon, 24 Jul 2017 11:19:45 -0400
changeset 33699 5ae35a1347fd
parent 33698 da7c285ec6da
child 33700 9a323773216c
bundle2: look for __next__ as well as next to identify iterators In Python 3, next is called __next__ and this was failing to catch some iterators.
mercurial/bundle2.py
--- a/mercurial/bundle2.py	Mon Jul 24 11:17:36 2017 -0400
+++ b/mercurial/bundle2.py	Mon Jul 24 11:19:45 2017 -0400
@@ -1070,7 +1070,8 @@
         Exists to handle the different methods to provide data to a part."""
         # we only support fixed size data now.
         # This will be improved in the future.
-        if util.safehasattr(self.data, 'next'):
+        if (util.safehasattr(self.data, 'next')
+            or util.safehasattr(self.data, '__next__')):
             buff = util.chunkbuffer(self.data)
             chunk = buff.read(preferedchunksize)
             while chunk: