# HG changeset patch # User Augie Fackler # Date 2018-11-01 19:43:43 # Node ID 99d5424eedc8105c713222ff693106a90559c013 # Parent 176c26a211232e89f7c6b9f23fee951c813e6c54 contrib: fix import-checker to not b'' module names on Python 3 Caught by the doctests. Differential Revision: https://phab.mercurial-scm.org/D5205 diff --git a/contrib/import-checker.py b/contrib/import-checker.py --- a/contrib/import-checker.py +++ b/contrib/import-checker.py @@ -674,6 +674,8 @@ def embedded(f, modname, src): # "starts" is "line number" (1-origin), but embedded() is # expected to return "line offset" (0-origin). Therefore, this # yields "starts - 1". + if not isinstance(modname, str): + modname = modname.decode('utf8') yield code, "%s[%d]" % (modname, starts), name, starts - 1 def sources(f, modname):