D5025: py3: make test-contrib-perf.t work on python 3

Yuya Nishihara yuya at tcha.org
Sat Oct 13 04:38:47 UTC 2018


> --- a/contrib/perf.py
> +++ b/contrib/perf.py
> @@ -75,14 +75,16 @@
>      _byteskwargs = pycompat.byteskwargs  # since 4.1 (or fbc3f73dc802)
>      _sysstr = pycompat.sysstr         # since 4.0 (or 2219f4f82ede)
>      _xrange = pycompat.xrange         # since 4.8 (or 7eba8f83129b)
> +    fsencode = pycompat.fsencode      # since 3.9 (or f4a5e0e86a7e)
>      if pycompat.ispy3:
>          _maxint = sys.maxsize  # per py3 docs for replacing maxint
>      else:
>          _maxint = sys.maxint
>  except (ImportError, AttributeError):
>      import inspect
>      getargspec = inspect.getargspec
>      _byteskwargs = identity
> +    fsencode = fsencode               # no py3 support

Fixed invalid reference in flight.

>  def perfstartup(ui, repo, **opts):
>      opts = _byteskwargs(opts)
>      timer, fm = gettimer(ui, opts)
> -    cmd = sys.argv[0]
> +    cmd = fsencode(sys.argv[0])

Applying fsencode() on sys.argv is probably wrong on Windows, but it's perf.py,
I don't care.



More information about the Mercurial-devel mailing list