From patchwork Thu Nov 10 13:09:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1,of,4,py3] error: wrap super() init call in try/except From: Yuya Nishihara X-Patchwork-Id: 17445 Message-Id: <20161110220923.c6b21520077a9fed63cb869e@tcha.org> To: Augie Fackler Cc: mercurial-devel@mercurial-scm.org, mj@zopatista.com Date: Thu, 10 Nov 2016 22:09:23 +0900 On Wed, 09 Nov 2016 11:23:38 -0500, Augie Fackler wrote: > # HG changeset patch > # User Augie Fackler > # Date 1476019730 14400 > # Sun Oct 09 09:28:50 2016 -0400 > # Node ID 6f2a1367baa59f33fcbc328aea1a637658ce345e > # Parent c9313a5b8e602b6b3b9a4427e5c2f452a711dd73 > error: wrap super() init call in try/except > > This is how we have to handle object's pickiness while still correctly > handling multiple inheritance MRO nonsense. > > diff --git a/mercurial/error.py b/mercurial/error.py > --- a/mercurial/error.py > +++ b/mercurial/error.py > @@ -23,7 +23,10 @@ class Hint(object): > """ > def __init__(self, *args, **kw): > self.hint = kw.pop('hint', None) > - super(Hint, self).__init__(*args, **kw) > + try: > + super(Hint, self).__init__(*args, **kw) > + except TypeError: > + pass I don't fully understand the MRO, but I believe what we need is u'hint'. --- a/mercurial/error.py +++ b/mercurial/error.py @@ -22,7 +22,7 @@ class Hint(object): pass remaining arguments to the exception class. """ def __init__(self, *args, **kw): - self.hint = kw.pop('hint', None) + self.hint = kw.pop(u'hint', None) super(Hint, self).__init__(*args, **kw) class RevlogError(Hint, Exception):