Submitter | phabricator |
---|---|
Date | Nov. 6, 2019, 10:56 p.m. |
Message ID | <differential-rev-PHID-DREV-7mwmhem2yod77u73mswa-req@mercurial-scm.org> |
Download | mbox | patch |
Permalink | /patch/42815/ |
State | Superseded |
Headers | show |
Comments
dlax added inline comments. INLINE COMMENTS > templateutil.py:114 > > + __metaclass__ = abc.ABCMeta > + This is ignored on Python 3 (meaning it's possible to instantiate `mappable` directly, despite some methods being abstract). It should be `class mappable(metaclass=abc.ABCMeta)` on Python 3. But I realize that there are other `__metaclass__ = abc.ABCMeta` in the code base. Do we handle this somehow or has this been overlooked? REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7262/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7262 To: durin42, #hg-reviewers, indygreg Cc: dlax, mercurial-devel
dlax added inline comments. INLINE COMMENTS > dlax wrote in templateutil.py:114 > This is ignored on Python 3 (meaning it's possible to instantiate `mappable` directly, despite some methods being abstract). It should be `class mappable(metaclass=abc.ABCMeta)` on Python 3. > But I realize that there are other `__metaclass__ = abc.ABCMeta` in the code base. Do we handle this somehow or has this been overlooked? Just seen D7272 <https://phab.mercurial-scm.org/D7272> and others which explain this. Nevermind. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7262/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7262 To: durin42, #hg-reviewers, indygreg Cc: dlax, mercurial-devel
Patch
diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -111,6 +111,8 @@ class mappable(object): """Object which can be converted to a single template mapping""" + __metaclass__ = abc.ABCMeta + def itermaps(self, context): yield self.tomap(context)