On Sun, 26 Mar 2017 18:36:36 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <r...@durin42.com>
> # Date 1490562287 14400
> #      Sun Mar 26 17:04:47 2017 -0400
> # Node ID 28149aad82cb12522f1ba50b0bb184d1f960a9c9
> # Parent  1250b7d77ba41c7ce1500d4c8e5fef921a14f683
> pycompat: forward encoding kwarg on open()
> 
> diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
> --- a/mercurial/pycompat.py
> +++ b/mercurial/pycompat.py
> @@ -163,8 +163,8 @@ if ispy3:
>      setattr = _wrapattrfunc(builtins.setattr)
>      xrange = builtins.range
>  
> -    def open(name, mode='r', buffering=-1):
> -        return builtins.open(name, sysstr(mode), buffering)
> +    def open(name, mode='r', buffering=-1, encoding=None):
> +        return builtins.open(name, sysstr(mode), buffering, encoding)

I have mixed feeling about this. open() should work on both Python 2 and 3,
but encoding isn't supported on Python 2. However, we would have to use
builtins.open() without this change.

I'll play with this and the fat-bytes patch to see if they can be factored
out to utility functions.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to