Patchwork [03,of,12,py3] manifest: add __next__ methods for Python 3

login
register
mail settings
Submitter Augie Fackler
Date March 12, 2017, 7:49 p.m.
Message ID <90450bdc25b4adba9e49.1489348192@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19224/
State Accepted
Headers show

Comments

Augie Fackler - March 12, 2017, 7:49 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489297400 18000
#      Sun Mar 12 00:43:20 2017 -0500
# Node ID 90450bdc25b4adba9e4941b62f3b77c264636842
# Parent  82cbf9cd26c318c4f3efa2e01d32f226c492cd11
manifest: add __next__ methods for Python 3

Python 3 renamed .next() in the iterator protocol to __next__().

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -123,6 +123,8 @@  class lazymanifestiter(object):
         zeropos = data.find('\x00', pos)
         return data[pos:zeropos]
 
+    __next__ = next
+
 class lazymanifestiterentries(object):
     def __init__(self, lm):
         self.lm = lm
@@ -146,6 +148,8 @@  class lazymanifestiterentries(object):
         self.pos += 1
         return (data[pos:zeropos], hashval, flags)
 
+    __next__ = next
+
 def unhexlify(data, extra, pos, length):
     s = data[pos:pos + length].decode('hex')
     if extra: