Submitter | Augie Fackler |
---|---|
Date | March 19, 2017, 6:11 a.m. |
Message ID | <bd83fb13fb210ae13eb6.1489903896@imladris.local> |
Download | mbox | patch |
Permalink | /patch/19443/ |
State | Accepted |
Headers | show |
Comments
On Sun, 19 Mar 2017 02:11:36 -0400, Augie Fackler wrote: > # HG changeset patch > # User Augie Fackler <augie@google.com> > # Date 1489899762 14400 > # Sun Mar 19 01:02:42 2017 -0400 > # Node ID bd83fb13fb210ae13eb6325581e164966614f9c5 > # Parent 028d4db7b85030b4285342c0dfd1fc7d4bd7e926 > error: use pycompat.sysstr to properly pop hints from **kw > > Fixes the hint mixin on Python 3. > > diff --git a/mercurial/error.py b/mercurial/error.py > --- a/mercurial/error.py > +++ b/mercurial/error.py > @@ -13,7 +13,8 @@ imports. > > from __future__ import absolute_import > > -# Do not import anything here, please > +# Do not import anything here, please. pycompat is the only exception. > +from . import pycompat > > class Hint(object): > """Mix-in to provide a hint of an error > @@ -22,7 +23,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(pycompat.sysstr('hint'), None) We can just use r'' ?
Patch
diff --git a/mercurial/error.py b/mercurial/error.py --- a/mercurial/error.py +++ b/mercurial/error.py @@ -13,7 +13,8 @@ imports. from __future__ import absolute_import -# Do not import anything here, please +# Do not import anything here, please. pycompat is the only exception. +from . import pycompat class Hint(object): """Mix-in to provide a hint of an error @@ -22,7 +23,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(pycompat.sysstr('hint'), None) super(Hint, self).__init__(*args, **kw) class RevlogError(Hint, Exception):