[PATCH 06 of 10 py3] bundle2: use modern Python division

Martin von Zweigbergk martinvonz at google.com
Mon Aug 14 14:17:56 EDT 2017


On Tue, Aug 1, 2017 at 1:34 PM, Augie Fackler <raf at durin42.com> wrote:
> # HG changeset patch
> # User Augie Fackler <augie at google.com>
> # Date 1500909456 14400
> #      Mon Jul 24 11:17:36 2017 -0400
> # Node ID 4c1f4e109bf90a8352a25a6b45a80fabcac6306b
> # Parent  7d68e38eb849015f034a0cbd66990777e635e8f6
> bundle2: use modern Python division
>
> This was failing on Python 3 because the / was returning a float,
> which was then making the __mul__ on a bytes sad.
>
> diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
> --- a/mercurial/bundle2.py
> +++ b/mercurial/bundle2.py
> @@ -145,7 +145,7 @@ future, dropping the stream may become a
>  preserve.
>  """
>
> -from __future__ import absolute_import
> +from __future__ import absolute_import, division

Is the import necessary? IIUC, that is for making '/' be for floating
point (which we don't care about here).

>
>  import errno
>  import re
> @@ -994,7 +994,7 @@ class bundlepart(object):
>          for key, value in advpar:
>              parsizes.append(len(key))
>              parsizes.append(len(value))
> -        paramsizes = _pack(_makefpartparamsizes(len(parsizes) / 2), *parsizes)
> +        paramsizes = _pack(_makefpartparamsizes(len(parsizes) // 2), *parsizes)
>          header.append(paramsizes)
>          # key, value
>          for key, value in manpar:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list