Patchwork py3: handle os.environ case

login
register
mail settings
Submitter Pulkit Goyal
Date Sept. 28, 2016, 11:31 a.m.
Message ID <cc742296eaad5b54c810.1475062289@pulkit-goyal>
Download mbox | patch
Permalink /patch/16797/
State Changes Requested
Headers show

Comments

Pulkit Goyal - Sept. 28, 2016, 11:31 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1475062024 -19800
#      Wed Sep 28 16:57:04 2016 +0530
# Node ID cc742296eaad5b54c81003b691897087c4a5d8fe
# Parent  85bd31515225e7fdf9bd88edde054db2c74a33f8
py3: handle os.environ case

os.environ accepts strings in both Python 2 and 3. We don't want to ship
unicodes to os.environ, so we need to use os.environb. Added a TODO to handle
the windows case.
Yuya Nishihara - Sept. 28, 2016, 3:42 p.m.
On Wed, 28 Sep 2016 17:01:29 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1475062024 -19800
> #      Wed Sep 28 16:57:04 2016 +0530
> # Node ID cc742296eaad5b54c81003b691897087c4a5d8fe
> # Parent  85bd31515225e7fdf9bd88edde054db2c74a33f8
> py3: handle os.environ case

> --- a/mercurial/pycompat.py	Sun Aug 21 13:16:21 2016 +0900
> +++ b/mercurial/pycompat.py	Wed Sep 28 16:57:04 2016 +0530
> @@ -10,6 +10,7 @@
>  
>  from __future__ import absolute_import
>  
> +import os
>  import sys
>  
>  if sys.version_info[0] < 3:
> @@ -164,3 +165,11 @@
>          "SimpleHTTPRequestHandler",
>          "CGIHTTPRequestHandler",
>      ))
> +
> +if sys.version_info[0] < 3:
> +    osenviron = os.environ
> +else:
> +    try:
> +        osenviron = os.environb
> +    except AttributeError: #Windows OS
> +        pass #TODO Handle windows case

I tried to implement this TODO. We need encoding.tolocal() to build a bytes
dict from unicode os.environ without losing round-trip utf-8 data, but
pycompat.py shouldn't import mercurial.* modules. So I'm thinking of adding
encoding.environ instead of pycompat.environ.

We'll also need to fix a couple of str/unicode issues in encoding.py to
make that actually work.
Pulkit Goyal - Sept. 28, 2016, 3:46 p.m.
> I tried to implement this TODO. We need encoding.tolocal() to build a bytes
> dict from unicode os.environ without losing round-trip utf-8 data, but
> pycompat.py shouldn't import mercurial.* modules. So I'm thinking of adding
> encoding.environ instead of pycompat.environ.
>
> We'll also need to fix a couple of str/unicode issues in encoding.py to
> make that actually work.

Okay I will work in this direction and come up with a patch.
Yuya Nishihara - Sept. 28, 2016, 4:09 p.m.
On Wed, 28 Sep 2016 21:16:09 +0530, Pulkit Goyal wrote:
> > I tried to implement this TODO. We need encoding.tolocal() to build a bytes
> > dict from unicode os.environ without losing round-trip utf-8 data, but
> > pycompat.py shouldn't import mercurial.* modules. So I'm thinking of adding
> > encoding.environ instead of pycompat.environ.
> >
> > We'll also need to fix a couple of str/unicode issues in encoding.py to
> > make that actually work.
> 
> Okay I will work in this direction and come up with a patch.

I have working patches which aren't ready to patchbomb. I think I can send
some of them tomorrow.
Pulkit Goyal - Sept. 28, 2016, 4:11 p.m.
Okay then I will wait for your patches to land rather than doing it myself.

On Wed, Sep 28, 2016 at 9:39 PM, Yuya Nishihara <yuya@tcha.org> wrote:
> On Wed, 28 Sep 2016 21:16:09 +0530, Pulkit Goyal wrote:
>> > I tried to implement this TODO. We need encoding.tolocal() to build a bytes
>> > dict from unicode os.environ without losing round-trip utf-8 data, but
>> > pycompat.py shouldn't import mercurial.* modules. So I'm thinking of adding
>> > encoding.environ instead of pycompat.environ.
>> >
>> > We'll also need to fix a couple of str/unicode issues in encoding.py to
>> > make that actually work.
>>
>> Okay I will work in this direction and come up with a patch.
>
> I have working patches which aren't ready to patchbomb. I think I can send
> some of them tomorrow.

Patch

diff -r 85bd31515225 -r cc742296eaad mercurial/encoding.py
--- a/mercurial/encoding.py	Sun Aug 21 13:16:21 2016 +0900
+++ b/mercurial/encoding.py	Wed Sep 28 16:57:04 2016 +0530
@@ -15,8 +15,11 @@ 
 
 from . import (
     error,
+    pycompat,
 )
 
+osenviron = pycompat.osenviron
+
 if sys.version_info[0] >= 3:
     unichr = chr
 
@@ -76,13 +79,13 @@ 
 }
 
 try:
-    encoding = os.environ.get("HGENCODING")
+    encoding = osenviron.get("HGENCODING")
     if not encoding:
         encoding = locale.getpreferredencoding() or 'ascii'
         encoding = _encodingfixers.get(encoding, lambda: encoding)()
 except locale.Error:
     encoding = 'ascii'
-encodingmode = os.environ.get("HGENCODINGMODE", "strict")
+encodingmode = osenviron.get("HGENCODINGMODE", "strict")
 fallbackencoding = 'ISO-8859-1'
 
 class localstr(str):
@@ -180,7 +183,7 @@ 
         raise error.Abort(k, hint="please check your locale settings")
 
 # How to treat ambiguous-width characters. Set to 'wide' to treat as wide.
-wide = (os.environ.get("HGENCODINGAMBIGUOUS", "narrow") == "wide"
+wide = (osenviron.get("HGENCODINGAMBIGUOUS", "narrow") == "wide"
         and "WFA" or "WF")
 
 def colwidth(s):
diff -r 85bd31515225 -r cc742296eaad mercurial/pycompat.py
--- a/mercurial/pycompat.py	Sun Aug 21 13:16:21 2016 +0900
+++ b/mercurial/pycompat.py	Wed Sep 28 16:57:04 2016 +0530
@@ -10,6 +10,7 @@ 
 
 from __future__ import absolute_import
 
+import os
 import sys
 
 if sys.version_info[0] < 3:
@@ -164,3 +165,11 @@ 
         "SimpleHTTPRequestHandler",
         "CGIHTTPRequestHandler",
     ))
+
+if sys.version_info[0] < 3:
+    osenviron = os.environ
+else:
+    try:
+        osenviron = os.environb
+    except AttributeError: #Windows OS
+        pass #TODO Handle windows case
diff -r 85bd31515225 -r cc742296eaad tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t	Sun Aug 21 13:16:21 2016 +0900
+++ b/tests/test-check-py3-compat.t	Wed Sep 28 16:57:04 2016 +0530
@@ -17,89 +17,90 @@ 
   > | 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 encoding.py:*)
-  hgext/automv.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/blackbox.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/bugzilla.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/censor.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/chgserver.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/children.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/churn.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/clonebundles.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/color.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/convert/bzr.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/convert/common.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/convert/convcmd.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/convert/cvs.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/convert/cvsps.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/convert/darcs.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/convert/filemap.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/convert/git.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/convert/gnuarch.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/convert/hg.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/convert/monotone.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/convert/p4.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/convert/subversion.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
+  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/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 encoding.py:*)
-  hgext/extdiff.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/factotum.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/fetch.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/fsmonitor/state.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/fsmonitor/watchmanclient.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/gpg.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/graphlog.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/hgk.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/histedit.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/journal.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/keyword.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/largefiles/basestore.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/largefiles/lfcommands.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/largefiles/lfutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/largefiles/localstore.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/largefiles/overrides.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/largefiles/proto.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/largefiles/remotestore.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/largefiles/reposetup.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/largefiles/storefactory.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/largefiles/uisetup.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
+  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/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 encoding.py:*)
-  hgext/notify.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/pager.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/patchbomb.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/purge.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/rebase.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/record.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/relink.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/schemes.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/share.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/shelve.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/strip.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/transplant.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/win32mbcs.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  hgext/win32text.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/archival.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/bookmarks.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/branchmap.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/bundle2.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/bundlerepo.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/byterange.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/changegroup.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/changelog.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/cmdutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/commands.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/commandserver.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/config.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/context.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/copies.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/crecord.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/dagparser.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/dagutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/destutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/dirstate.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/discovery.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
-  mercurial/dispatch.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*)
+  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:*)
+  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:*)
@@ -165,10 +166,11 @@ 
   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/verify.py: error importing module: <TypeError> unorderable types: str() >= tuple() (line *)
+  mercurial/util.py: error importing module: <TypeError> encode() argument 1 must be str, not bytes (line *)
+  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 *)
-  mercurial/wireproto.py: error importing module: <TypeError> unorderable types: str() >= tuple() (line *)
+  mercurial/wireproto.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at util.py:*)
 
 #endif
 
@@ -176,5 +178,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 encoding.py:*)
+  hgext/highlight/highlight.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*)
 #endif