[PATCH 3 of 3] [py3] hgmanpage: use a py2 and py3 compatible iterable protocol

Philippe Pepiot philippe.pepiot at logilab.fr
Thu Apr 4 13:09:53 EDT 2019


# HG changeset patch
# User Philippe Pepiot <philippe.pepiot at logilab.fr>
# Date 1554397717 -7200
#      Thu Apr 04 19:08:37 2019 +0200
# Node ID c180963580407113ef801ebf98a3f799b9b8cef5
# Parent  1cfe2d1794ee65647bc95615e5d032cc6e54352c
[py3] hgmanpage: use a py2 and py3 compatible iterable protocol

diff --git a/doc/hgmanpage.py b/doc/hgmanpage.py
--- a/doc/hgmanpage.py
+++ b/doc/hgmanpage.py
@@ -335,7 +335,7 @@ class Translator(nodes.NodeVisitor):
                 elif style.endswith('roman'):
                     self._indent = 5
 
-            def next(self):
+            def __next__(self):
                 if self._style == 'bullet':
                     return self.enum_style[self._style]
                 elif self._style == 'emdash':
@@ -353,6 +353,9 @@ class Translator(nodes.NodeVisitor):
                     return res.lower()
                 else:
                     return "%d." % self._cnt
+
+            next = __next__
+
             def get_width(self):
                 return self._indent
             def __repr__(self):


More information about the Mercurial-devel mailing list