D7550: chg: fix chg to work with py3.7+ "coercing" the locale

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Thu Dec 12 09:07:58 EST 2019

yuja added a comment.

  >   > Sigh. Can we work around this weird behavior by making chg do
  >   > `putenv("PYTHONCOERCECLOCALE=0")`? I think it's simple and more desired
  >   > behavior than the default of Python 3.
  >   I had considered that and was concerned it would create an observable, surprising/confusing difference between chg and non-chg: if chg sets PYTHONCOERCECLOCALE=0, hg won't have LC_CTYPE in the environment, and it WILL have PYTHONCOERCECLOCALE in the environment. When it starts external tools (like merge tools), this may change behavior in some observable fashion, and if the user stops using chg and uses just plain hg, it will have LC_CTYPE in the environment.
  Yeah, that could happen. I checked the CPython code, but there's no easy way
  to disable PYTHONCOERCECLOCALE at all without writing a C wrapper or rebuilding
  Python itself with --without-c-locale-coercion.
  I don't care much about the pollution of subprocess environments since Python
  does pollute LC_CTYPE by default, which is IMHO worse, but I agree it isn't
  nice to introduce behavior change between pure hg and chg. So we'll have to
  take this patch, sigh.
  Queued, thanks.

  rHG Mercurial



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

More information about the Mercurial-devel mailing list