[PATCH 5 of 8 py3] error: use pycompat.sysstr to properly pop hints from **kw

Yuya Nishihara yuya at tcha.org
Sun Mar 19 10:35:55 EDT 2017


On Sun, 19 Mar 2017 02:11:36 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie at 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'' ?


More information about the Mercurial-devel mailing list