Patchwork [5,of,5] py3: make i18n use encoding.environ

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 29, 2016, 2:50 p.m.
Message ID <2e15b10fd5c7ed82e928.1475160630@mimosa>
Download mbox | patch
Permalink /patch/16804/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 29, 2016, 2:50 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1475060852 -32400
#      Wed Sep 28 20:07:32 2016 +0900
# Node ID 2e15b10fd5c7ed82e9284ebc9f600abee7cdd9ad
# Parent  4ab92e485ecec5581c8d263895ced0d13036d512
py3: make i18n use encoding.environ
Pulkit Goyal - Sept. 30, 2016, 5:03 p.m.
Thanks for the patches. I think they should be added to committed :) .

On Thu, Sep 29, 2016 at 8:20 PM, Yuya Nishihara <yuya@tcha.org> wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1475060852 -32400
> #      Wed Sep 28 20:07:32 2016 +0900
> # Node ID 2e15b10fd5c7ed82e9284ebc9f600abee7cdd9ad
> # Parent  4ab92e485ecec5581c8d263895ced0d13036d512
> py3: make i18n use encoding.environ
>
> diff --git a/mercurial/i18n.py b/mercurial/i18n.py
> --- a/mercurial/i18n.py
> +++ b/mercurial/i18n.py
> @@ -27,10 +27,10 @@ except NameError:
>
>  _languages = None
>  if (os.name == 'nt'
> -    and 'LANGUAGE' not in os.environ
> -    and 'LC_ALL' not in os.environ
> -    and 'LC_MESSAGES' not in os.environ
> -    and 'LANG' not in os.environ):
> +    and 'LANGUAGE' not in encoding.environ
> +    and 'LC_ALL' not in encoding.environ
> +    and 'LC_MESSAGES' not in encoding.environ
> +    and 'LANG' not in encoding.environ):
>      # Try to detect UI language by "User Interface Language Management" API
>      # if no locale variables are set. Note that locale.getdefaultlocale()
>      # uses GetLocaleInfo(), which may be different from UI language.
> @@ -92,9 +92,10 @@ def gettext(message):
>      return _msgcache[message]
>
>  def _plain():
> -    if 'HGPLAIN' not in os.environ and 'HGPLAINEXCEPT' not in os.environ:
> +    if ('HGPLAIN' not in encoding.environ
> +        and 'HGPLAINEXCEPT' not in encoding.environ):
>          return False
> -    exceptions = os.environ.get('HGPLAINEXCEPT', '').strip().split(',')
> +    exceptions = encoding.environ.get('HGPLAINEXCEPT', '').strip().split(',')
>      return 'i18n' not in exceptions
>
>  if _plain():
> diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
> --- a/tests/test-check-py3-compat.t
> +++ b/tests/test-check-py3-compat.t
> @@ -17,101 +17,96 @@
>    > | xargs $PYTHON3 contrib/check-py3-compat.py \
>    > | sed 's/[0-9][0-9]*)$/*)/'
>    doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *)
> -  hgext/acl.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/automv.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/blackbox.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/bugzilla.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/censor.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/chgserver.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/children.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/churn.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/clonebundles.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/color.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/convert/bzr.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/convert/common.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/convert/convcmd.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/convert/cvs.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/convert/cvsps.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/convert/darcs.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/convert/filemap.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/convert/git.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/convert/gnuarch.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/convert/hg.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/convert/monotone.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/convert/p4.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/convert/subversion.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> +  hgext/acl.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/automv.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/blackbox.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/bugzilla.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/censor.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/chgserver.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/children.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/churn.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/clonebundles.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/color.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/convert/bzr.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *)
> +  hgext/convert/common.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/convert/convcmd.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/convert/cvs.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/convert/cvsps.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/convert/darcs.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/convert/filemap.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *)
> +  hgext/convert/git.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/convert/gnuarch.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/convert/hg.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/convert/monotone.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/convert/p4.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/convert/subversion.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
>    hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line *)
> -  hgext/eol.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/extdiff.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/factotum.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/fetch.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/fsmonitor/state.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/fsmonitor/watchmanclient.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/gpg.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/graphlog.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/hgk.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/histedit.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/journal.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/keyword.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/largefiles/basestore.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/largefiles/lfcommands.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/largefiles/lfutil.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/largefiles/localstore.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/largefiles/overrides.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/largefiles/proto.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/largefiles/remotestore.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/largefiles/reposetup.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/largefiles/storefactory.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/largefiles/uisetup.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> +  hgext/eol.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/extdiff.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/factotum.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/fetch.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/fsmonitor/state.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/fsmonitor/watchmanclient.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/gpg.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/graphlog.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/hgk.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/histedit.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/journal.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/keyword.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/largefiles/basestore.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/largefiles/lfcommands.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/largefiles/lfutil.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/largefiles/localstore.py: error importing module: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *)
> +  hgext/largefiles/overrides.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/largefiles/proto.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/largefiles/remotestore.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/largefiles/reposetup.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/largefiles/storefactory.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/largefiles/uisetup.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
>    hgext/largefiles/wirestore.py: error importing module: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *)
> -  hgext/mq.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/notify.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/pager.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/patchbomb.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/purge.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/rebase.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/record.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/relink.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/schemes.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/share.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/shelve.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/strip.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/transplant.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/win32mbcs.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  hgext/win32text.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/archival.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/bookmarks.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/branchmap.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/bundle2.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/bundlerepo.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/byterange.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/changegroup.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/changelog.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/cmdutil.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/commands.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/commandserver.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/config.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/context.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/copies.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/crecord.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/dagparser.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/dagutil.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/destutil.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/dirstate.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/discovery.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/dispatch.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> +  hgext/mq.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/notify.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/pager.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/patchbomb.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/purge.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/rebase.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/record.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/relink.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/schemes.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/share.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/shelve.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/strip.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/transplant.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  hgext/win32text.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/archival.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/bookmarks.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/branchmap.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/bundle2.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/bundlerepo.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/byterange.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/changegroup.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/changelog.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/cmdutil.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/commands.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/commandserver.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/config.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/context.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/copies.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/crecord.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/destutil.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/dirstate.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/discovery.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/dispatch.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
>    mercurial/encoding.py: error importing module: <TypeError> bytes expected, not str (line *)
> -  mercurial/exchange.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/extensions.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/fancyopts.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/filelog.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/filemerge.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/fileset.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/formatter.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/graphmod.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/hbisect.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/help.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/hg.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> +  mercurial/exchange.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/extensions.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/filelog.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/filemerge.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/fileset.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/formatter.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/graphmod.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/help.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/hg.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
>    mercurial/hgweb/common.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *)
>    mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *)
>    mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *)
> @@ -121,9 +116,10 @@
>    mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *)
>    mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *)
>    mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *)
> -  mercurial/hook.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/httpconnection.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> -  mercurial/httppeer.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> +  mercurial/hook.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/httpconnection.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/httppeer.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> +  mercurial/i18n.py: error importing module: <TypeError> bytes expected, not str (line *)
>    mercurial/keepalive.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
>    mercurial/localrepo.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
>    mercurial/lock.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> @@ -166,7 +162,7 @@
>    mercurial/ui.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
>    mercurial/unionrepo.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
>    mercurial/url.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
> -  mercurial/util.py: error importing module: <TypeError> encode() argument 1 must be str, not bytes (line *)
> +  mercurial/util.py: error importing: <TypeError> encode() argument 1 must be str, not bytes (error at i18n.py:*)
>    mercurial/verify.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
>    mercurial/win32.py: error importing module: <ImportError> No module named 'msvcrt' (line *)
>    mercurial/windows.py: error importing module: <ImportError> No module named 'msvcrt' (line *)
> @@ -178,5 +174,5 @@
>    $ hg files 'set:(**.py) and grep(pygments)' | sed 's|\\|/|g' \
>    > | xargs $PYTHON3 contrib/check-py3-compat.py \
>    > | sed 's/[0-9][0-9]*)$/*)/'
> -  hgext/highlight/highlight.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
> +  hgext/highlight/highlight.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
>  #endif
Augie Fackler - Sept. 30, 2016, 7:56 p.m.
On Thu, Sep 29, 2016 at 11:50:30PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1475060852 -32400
> #      Wed Sep 28 20:07:32 2016 +0900
> # Node ID 2e15b10fd5c7ed82e9284ebc9f600abee7cdd9ad
> # Parent  4ab92e485ecec5581c8d263895ced0d13036d512
> py3: make i18n use encoding.environ

These are queued, thanks!

Patch

diff --git a/mercurial/i18n.py b/mercurial/i18n.py
--- a/mercurial/i18n.py
+++ b/mercurial/i18n.py
@@ -27,10 +27,10 @@  except NameError:
 
 _languages = None
 if (os.name == 'nt'
-    and 'LANGUAGE' not in os.environ
-    and 'LC_ALL' not in os.environ
-    and 'LC_MESSAGES' not in os.environ
-    and 'LANG' not in os.environ):
+    and 'LANGUAGE' not in encoding.environ
+    and 'LC_ALL' not in encoding.environ
+    and 'LC_MESSAGES' not in encoding.environ
+    and 'LANG' not in encoding.environ):
     # Try to detect UI language by "User Interface Language Management" API
     # if no locale variables are set. Note that locale.getdefaultlocale()
     # uses GetLocaleInfo(), which may be different from UI language.
@@ -92,9 +92,10 @@  def gettext(message):
     return _msgcache[message]
 
 def _plain():
-    if 'HGPLAIN' not in os.environ and 'HGPLAINEXCEPT' not in os.environ:
+    if ('HGPLAIN' not in encoding.environ
+        and 'HGPLAINEXCEPT' not in encoding.environ):
         return False
-    exceptions = os.environ.get('HGPLAINEXCEPT', '').strip().split(',')
+    exceptions = encoding.environ.get('HGPLAINEXCEPT', '').strip().split(',')
     return 'i18n' not in exceptions
 
 if _plain():
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -17,101 +17,96 @@ 
   > | xargs $PYTHON3 contrib/check-py3-compat.py \
   > | sed 's/[0-9][0-9]*)$/*)/'
   doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *)
-  hgext/acl.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/automv.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/blackbox.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/bugzilla.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/censor.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/chgserver.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/children.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/churn.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/clonebundles.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/color.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/convert/bzr.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/convert/common.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/convert/convcmd.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/convert/cvs.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/convert/cvsps.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/convert/darcs.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/convert/filemap.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/convert/git.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/convert/gnuarch.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/convert/hg.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/convert/monotone.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/convert/p4.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/convert/subversion.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
+  hgext/acl.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/automv.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/blackbox.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/bugzilla.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/censor.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/chgserver.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/children.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/churn.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/clonebundles.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/color.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/convert/bzr.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *)
+  hgext/convert/common.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/convert/convcmd.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/convert/cvs.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/convert/cvsps.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/convert/darcs.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/convert/filemap.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *)
+  hgext/convert/git.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/convert/gnuarch.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/convert/hg.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/convert/monotone.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/convert/p4.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/convert/subversion.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
   hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line *)
-  hgext/eol.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/extdiff.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/factotum.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/fetch.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/fsmonitor/state.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/fsmonitor/watchmanclient.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/gpg.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/graphlog.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/hgk.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/histedit.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/journal.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/keyword.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/largefiles/basestore.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/largefiles/lfcommands.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/largefiles/lfutil.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/largefiles/localstore.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/largefiles/overrides.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/largefiles/proto.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/largefiles/remotestore.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/largefiles/reposetup.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/largefiles/storefactory.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/largefiles/uisetup.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
+  hgext/eol.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/extdiff.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/factotum.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/fetch.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/fsmonitor/state.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/fsmonitor/watchmanclient.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/gpg.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/graphlog.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/hgk.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/histedit.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/journal.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/keyword.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/largefiles/basestore.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/largefiles/lfcommands.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/largefiles/lfutil.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/largefiles/localstore.py: error importing module: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *)
+  hgext/largefiles/overrides.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/largefiles/proto.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/largefiles/remotestore.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/largefiles/reposetup.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/largefiles/storefactory.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/largefiles/uisetup.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
   hgext/largefiles/wirestore.py: error importing module: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *)
-  hgext/mq.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/notify.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/pager.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/patchbomb.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/purge.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/rebase.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/record.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/relink.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/schemes.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/share.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/shelve.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/strip.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/transplant.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/win32mbcs.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  hgext/win32text.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/archival.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/bookmarks.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/branchmap.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/bundle2.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/bundlerepo.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/byterange.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/changegroup.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/changelog.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/cmdutil.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/commands.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/commandserver.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/config.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/context.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/copies.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/crecord.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/dagparser.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/dagutil.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/destutil.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/dirstate.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/discovery.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/dispatch.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
+  hgext/mq.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/notify.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/pager.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/patchbomb.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/purge.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/rebase.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/record.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/relink.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/schemes.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/share.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/shelve.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/strip.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/transplant.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  hgext/win32text.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/archival.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/bookmarks.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/branchmap.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/bundle2.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/bundlerepo.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/byterange.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/changegroup.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/changelog.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/cmdutil.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/commands.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/commandserver.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/config.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/context.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/copies.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/crecord.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/destutil.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/dirstate.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/discovery.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/dispatch.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
   mercurial/encoding.py: error importing module: <TypeError> bytes expected, not str (line *)
-  mercurial/exchange.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/extensions.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/fancyopts.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/filelog.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/filemerge.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/fileset.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/formatter.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/graphmod.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/hbisect.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/help.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/hg.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
+  mercurial/exchange.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/extensions.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/filelog.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/filemerge.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/fileset.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/formatter.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/graphmod.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/help.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/hg.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
   mercurial/hgweb/common.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *)
   mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *)
   mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *)
@@ -121,9 +116,10 @@ 
   mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *)
   mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *)
   mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *)
-  mercurial/hook.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/httpconnection.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
-  mercurial/httppeer.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
+  mercurial/hook.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/httpconnection.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/httppeer.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
+  mercurial/i18n.py: error importing module: <TypeError> bytes expected, not str (line *)
   mercurial/keepalive.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
   mercurial/localrepo.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
   mercurial/lock.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
@@ -166,7 +162,7 @@ 
   mercurial/ui.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
   mercurial/unionrepo.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
   mercurial/url.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
-  mercurial/util.py: error importing module: <TypeError> encode() argument 1 must be str, not bytes (line *)
+  mercurial/util.py: error importing: <TypeError> encode() argument 1 must be str, not bytes (error at i18n.py:*)
   mercurial/verify.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
   mercurial/win32.py: error importing module: <ImportError> No module named 'msvcrt' (line *)
   mercurial/windows.py: error importing module: <ImportError> No module named 'msvcrt' (line *)
@@ -178,5 +174,5 @@ 
   $ hg files 'set:(**.py) and grep(pygments)' | sed 's|\\|/|g' \
   > | xargs $PYTHON3 contrib/check-py3-compat.py \
   > | sed 's/[0-9][0-9]*)$/*)/'
-  hgext/highlight/highlight.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
+  hgext/highlight/highlight.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
 #endif