Patchwork [9,of,9,V2] util: use unicode literals to appease Python 3

login
register
mail settings
Submitter Gregory Szorc
Date June 25, 2016, 9:11 p.m.
Message ID <594e3c4aa807bce363a2.1466889083@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/15623/
State Superseded
Headers show

Comments

Gregory Szorc - June 25, 2016, 9:11 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1466888975 25200
#      Sat Jun 25 14:09:35 2016 -0700
# Node ID 594e3c4aa807bce363a22da57a90a400259f2c46
# Parent  3d85e50896c8306d4186cc6600ebddb90cf6c93e
util: use unicode literals to appease Python 3

The _hexttochr() code may not be correct for use in _urlunquote()
but at least util.py now imports cleanly under Python 3.
timeless - June 27, 2016, 10:18 p.m.
Gregory Szorc <gregory.szorc@gmail.com> wrote:
>      #'urlreq',

you should probably stick a `u` here too (not blocking, just a thought)

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -41,23 +41,23 @@  from . import (
     error,
     i18n,
     osutil,
     parsers,
     pycompat,
 )
 
 for attr in (
-    'empty',
-    'pickle',
-    'queue',
-    'urlerr',
+    u'empty',
+    u'pickle',
+    u'queue',
+    u'urlerr',
     # we do import urlreq, but we do it outside the loop
     #'urlreq',
-    'stringio',
+    u'stringio',
 ):
     globals()[attr] = getattr(pycompat, attr)
 
 # This line is to make pyflakes happy:
 urlreq = pycompat.urlreq
 
 if os.name == 'nt':
     from . import windows as platform
@@ -523,17 +523,17 @@  class sortdict(dict):
         dict.__setitem__(self, key, val)
 
 class _lrucachenode(object):
     """A node in a doubly linked list.
 
     Holds a reference to nodes on either side as well as a key-value
     pair for the dictionary entry.
     """
-    __slots__ = ('next', 'prev', 'key', 'value')
+    __slots__ = (u'next', u'prev', u'key', u'value')
 
     def __init__(self):
         self.next = None
         self.prev = None
 
         self.key = _notset
         self.value = None
 
@@ -887,20 +887,20 @@  def pathto(root, n1, n2):
 def mainfrozen():
     """return True if we are a frozen executable.
 
     The code supports py2exe (most common, Windows only) and tools/freeze
     (portable, not much used).
     """
     return (safehasattr(sys, "frozen") or # new py2exe
             safehasattr(sys, "importers") or # old py2exe
-            imp.is_frozen("__main__")) # tools/freeze
+            imp.is_frozen(u"__main__")) # tools/freeze
 
 # the location of data files matching the source code
-if mainfrozen() and getattr(sys, 'frozen', None) != 'macosx_app':
+if mainfrozen() and getattr(sys, 'frozen', None) != u'macosx_app':
     # executable version (py2exe) doesn't support __file__
     datapath = os.path.dirname(sys.executable)
 else:
     datapath = os.path.dirname(__file__)
 
 i18n.setdatapath(datapath)
 
 _hgexecutable = None
@@ -2241,17 +2241,17 @@  def getport(port):
 
 def parsebool(s):
     """Parse s into a boolean.
 
     If s is not a valid boolean, returns None.
     """
     return _booleans.get(s.lower(), None)
 
-_hexdig = '0123456789ABCDEFabcdef'
+_hexdig = u'0123456789ABCDEFabcdef'
 _hextochr = dict((a + b, chr(int(a + b, 16)))
                  for a in _hexdig for b in _hexdig)
 
 def _urlunquote(s):
     """Decode HTTP/HTML % encoding.
 
     >>> _urlunquote('abc%20def')
     'abc def'
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
@@ -19,158 +19,134 @@ 
   tests/md5sum.py not using absolute_import
   tests/readlink.py not using absolute_import
   tests/run-tests.py not using absolute_import
   tests/test-demandimport.py not using absolute_import
 
 #if py3exe
   $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py
   doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  hgext/acl.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
   hgext/automv.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (glob)
-  hgext/blackbox.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  hgext/blackbox.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
   hgext/bugzilla.py: error importing module: <ImportError> No module named 'urlparse' (line *) (glob)
-  hgext/censor.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  hgext/censor.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
   hgext/chgserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob)
-  hgext/children.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/churn.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/clonebundles.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  hgext/children.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/churn.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/clonebundles.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
   hgext/color.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   hgext/convert/bzr.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
-  hgext/convert/common.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/convert/convcmd.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/convert/cvs.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/convert/cvsps.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/convert/darcs.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  hgext/convert/convcmd.py: error importing: <SyntaxError> invalid syntax (bundle2.py, line 992) (error at bundlerepo.py:*) (glob)
+  hgext/convert/cvs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
+  hgext/convert/cvsps.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/convert/darcs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
   hgext/convert/filemap.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
-  hgext/convert/git.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/convert/gnuarch.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/convert/hg.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/convert/monotone.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/convert/p4.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/convert/subversion.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  hgext/convert/git.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
+  hgext/convert/gnuarch.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
+  hgext/convert/hg.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  hgext/convert/monotone.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
+  hgext/convert/p4.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
+  hgext/convert/subversion.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
   hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line *) (glob)
-  hgext/eol.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  hgext/eol.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
   hgext/extdiff.py: error importing module: <SyntaxError> invalid syntax (archival.py, line *) (glob)
   hgext/factotum.py: error importing: <ImportError> No module named 'rfc822' (error at __init__.py:*) (glob)
-  hgext/fetch.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/fsmonitor/state.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/fsmonitor/watchmanclient.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/gpg.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/graphlog.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/hgk.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/highlight/highlight.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  hgext/fetch.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/fsmonitor/watchmanclient.py: error importing module: <SystemError> Parent module 'hgext.fsmonitor' not loaded, cannot perform relative import (line *) (glob)
+  hgext/gpg.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/graphlog.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/hgk.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/highlight/highlight.py: error importing module: <ImportError> No module named 'pygments' (line *) (glob)
   hgext/histedit.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line *) (glob)
-  hgext/keyword.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/largefiles/basestore.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/largefiles/lfcommands.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/largefiles/lfutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  hgext/keyword.py: error importing: <ImportError> No module named 'BaseHTTPServer' (error at common.py:*) (glob)
+  hgext/largefiles/basestore.py: error importing module: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) (glob)
+  hgext/largefiles/lfcommands.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/largefiles/lfutil.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
   hgext/largefiles/localstore.py: error importing module: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) (glob)
   hgext/largefiles/overrides.py: error importing module: <SyntaxError> invalid syntax (archival.py, line *) (glob)
   hgext/largefiles/proto.py: error importing: <ImportError> No module named 'httplib' (error at httppeer.py:*) (glob)
-  hgext/largefiles/remotestore.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/largefiles/reposetup.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/largefiles/storefactory.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/largefiles/uisetup.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  hgext/largefiles/remotestore.py: error importing: <SyntaxError> invalid syntax (bundle2.py, line 992) (error at wireproto.py:*) (glob)
+  hgext/largefiles/reposetup.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  hgext/largefiles/storefactory.py: error importing: <SyntaxError> invalid syntax (bundle2.py, line 992) (error at bundlerepo.py:*) (glob)
+  hgext/largefiles/uisetup.py: error importing: <ImportError> No module named 'BaseHTTPServer' (error at common.py:*) (glob)
   hgext/largefiles/wirestore.py: error importing module: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) (glob)
-  hgext/mq.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/notify.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/pager.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/patchbomb.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/purge.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/rebase.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/record.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/relink.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/schemes.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  hgext/share.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  hgext/mq.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/notify.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/pager.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/patchbomb.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/purge.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/rebase.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/record.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/relink.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/schemes.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  hgext/share.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
   hgext/shelve.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line *) (glob)
-  hgext/strip.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  hgext/strip.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
   hgext/transplant.py: error importing: <SyntaxError> invalid syntax (bundle2.py, line *) (glob)
-  hgext/win32text.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
   mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  mercurial/bookmarks.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/branchmap.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  mercurial/branchmap.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
   mercurial/bundle2.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   mercurial/bundlerepo.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line *) (glob)
-  mercurial/byterange.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/changegroup.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/changelog.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/cmdutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  mercurial/changegroup.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/changelog.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  mercurial/cmdutil.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
   mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   mercurial/commandserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob)
-  mercurial/config.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/context.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/copies.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/crecord.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/destutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/dirstate.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/discovery.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/dispatch.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/exchange.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/extensions.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/filelog.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/filemerge.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/fileset.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/formatter.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/graphmod.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/help.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/hg.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  mercurial/context.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/copies.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/crecord.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/dirstate.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/discovery.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/dispatch.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  mercurial/exchange.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line 992) (line *) (glob)
+  mercurial/extensions.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  mercurial/filelog.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  mercurial/filemerge.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/fileset.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/formatter.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/graphmod.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/help.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  mercurial/hg.py: error importing: <SyntaxError> invalid syntax (bundle2.py, line 992) (error at bundlerepo.py:*) (glob)
   mercurial/hgweb/common.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob)
   mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
   mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
   mercurial/hgweb/protocol.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
   mercurial/hgweb/request.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
   mercurial/hgweb/server.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob)
   mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
   mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
   mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
-  mercurial/hook.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  mercurial/hook.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
   mercurial/httpconnection.py: error importing: <ImportError> No module named 'rfc822' (error at __init__.py:*) (glob)
   mercurial/httppeer.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
   mercurial/keepalive.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
-  mercurial/localrepo.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/lock.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  mercurial/localrepo.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
   mercurial/mail.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/manifest.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/match.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/mdiff.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/merge.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/minirst.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/namespaces.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/obsolete.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/patch.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/pathutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/peer.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  mercurial/manifest.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  mercurial/merge.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/namespaces.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/patch.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
   mercurial/pure/mpatch.py: error importing module: <ImportError> cannot import name 'pycompat' (line *) (glob)
   mercurial/pure/parsers.py: error importing module: <ImportError> No module named 'mercurial.pure.node' (line *) (glob)
-  mercurial/pushkey.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/pvec.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/registrar.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
   mercurial/repair.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line *) (glob)
-  mercurial/repoview.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/revlog.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/revset.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/scmutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  mercurial/revlog.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/revset.py: error importing module: <AttributeError> 'dict' object has no attribute 'iteritems' (line *) (glob)
+  mercurial/scmutil.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
   mercurial/scmwindows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
-  mercurial/similar.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/simplemerge.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/sshpeer.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/sshserver.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/sslutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/statichttprepo.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/store.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/streamclone.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/subrepo.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/tagmerge.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/tags.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/templatefilters.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/templatekw.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/templater.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/transaction.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/ui.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
-  mercurial/unionrepo.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
+  mercurial/simplemerge.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/sshpeer.py: error importing: <SyntaxError> invalid syntax (bundle2.py, line 992) (error at wireproto.py:*) (glob)
+  mercurial/sshserver.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/statichttprepo.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/store.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/streamclone.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/subrepo.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/templatefilters.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/templatekw.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/templater.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/ui.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
+  mercurial/unionrepo.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
   mercurial/url.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
-  mercurial/verify.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
+  mercurial/verify.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*) (glob)
   mercurial/win32.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob)
   mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
   mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line *) (glob)
 
 #endif