[PATCH 8 of 8 py3 v3] policy: try and always have a bytes for module policy

Pulkit Goyal 7895pulkit at gmail.com
Thu Mar 9 01:44:49 EST 2017


On Thu, Mar 9, 2017 at 4:52 AM, Augie Fackler <raf at durin42.com> wrote:

> # HG changeset patch
> # User Augie Fackler <raf at durin42.com>
> # Date 1489014701 18000
> #      Wed Mar 08 18:11:41 2017 -0500
> # Node ID 51474edf0b672b9152d51a042df8b1161ef41fb1
> # Parent  eefc1048d292cda28d4493ac5a6ea56c68fed1e2
> policy: try and always have a bytes for module policy
>
> debuginstall now runs cleanly in Python 3.
>
> diff --git a/mercurial/policy.py b/mercurial/policy.py
> --- a/mercurial/policy.py
> +++ b/mercurial/policy.py
> @@ -39,7 +39,7 @@ if '__pypy__' in sys.builtin_module_name
>  # Our C extensions aren't yet compatible with Python 3. So use pure Python
>  # on Python 3 for now.
>

​I guess our C extensions are Python 3 compatible. indygreg worked on them
in the last sprint.
​


>  if sys.version_info[0] >= 3:
> -    policy = 'py'
> +    policy = b'py'
>

​This is done by transformer, so I am not sure why we need to do this
manually.


>  # Environment variable can always force settings.
>  policy = os.environ.get('HGMODULEPOLICY', policy)
>

​We need to use encoding.environ here for bytes consistency, otherwise
passing bytes here will result in error.​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170309/7220b2ec/attachment.html>


More information about the Mercurial-devel mailing list