Patchwork [2,of,6] bundle2: update check for a generator to work on Python 3

login
register
mail settings
Submitter Augie Fackler
Date Sept. 19, 2017, 4:08 p.m.
Message ID <43d20140917917f63e9b.1505837305@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/24019/
State Accepted
Headers show

Comments

Augie Fackler - Sept. 19, 2017, 4:08 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1505756165 14400
#      Mon Sep 18 13:36:05 2017 -0400
# Node ID 43d20140917917f63e9b1d030847260fdf637d8b
# Parent  d3ecff8a8e1e49438fb7027adb12b678f394ff11
bundle2: update check for a generator to work on Python 3

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1019,7 +1019,8 @@  class bundlepart(object):
                 msg.append(')')
             if not self.data:
                 msg.append(' empty payload')
-            elif util.safehasattr(self.data, 'next'):
+            elif (util.safehasattr(self.data, 'next')
+                  or util.safehasattr(self.data, '__next__')):
                 msg.append(' streamed payload')
             else:
                 msg.append(' %i bytes payload' % len(self.data))