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

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Tue Oct 16 00:11:02 EDT 2018


mharbison72 added a comment.


  In https://phab.mercurial-scm.org/D5025#76443, @mharbison72 wrote:
  
  > In https://phab.mercurial-scm.org/D5025#75556, @yuja wrote:
  >
  > > >   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.
  >
  >
  > Sadly, it doesn't work on Windows.  But since os.system() is called with an r-string, bytes wouldn't be right anyway.  When I simply formatted in sys.argv[0], I got this:
  >
  >   --- c:/Users/Matt/projects/hg_py3/tests/test-contrib-perf.t
  >   +++ c:/Users/Matt/projects/hg_py3/tests/test-contrib-perf.t.err
  >   @@ -184,6 +184,7 @@
  >      $ hg perfrevrange
  >      $ hg perfrevset 'all()'
  >      $ hg perfstartup
  >   +  (null): can't open file '<unprintable file name>': [Errno 2] $ENOENT$
  >      $ hg perfstatus
  >      $ hg perftags
  >      $ hg perftemplating
  >
  >
  > This will be good to figure out because there are ~400 other instances of this error, mostly around launching hooks.
  
  
  Nevermind.  Looking closer at exewrapper.c, the signature of Py_Main() changed.  Is there any reason not to convert that file to the usual TCHAR type, and #define UNICODE when building for py3?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5025

To: pulkit, #hg-reviewers
Cc: mharbison72, yuja, mjpieters, mercurial-devel


More information about the Mercurial-devel mailing list