[Bug 5632] New: python3 demandimport busted for relative imports in hgext.journal et al

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Wed Jul 26 04:35:49 UTC 2017


https://bz.mercurial-scm.org/show_bug.cgi?id=5632

            Bug ID: 5632
           Summary: python3 demandimport busted for relative imports in
                    hgext.journal et al
           Product: Mercurial
           Version: 3.8-rc
          Hardware: PC
                OS: Mac OS
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: durin42 at gmail.com
                CC: mercurial-devel at mercurial-scm.org

I caught this while working on test-check-help.t, which is probably not easy to
fix. Symptoms:

  $ HGRCPATH=/dev/null python3.6 ./hg help qnew
  abort: no such help topic: qnew

compare with:

  $ HGRCPATH=no python2.7 ./hg help qnew
'qnew' is provided by the following extension:

    mq            manage a stack of patches

(use 'hg help extensions' for information on enabling extensions)

This is triggered by:

  File "mercurial/extensions.py", line 612, in findcmd
    mod = loadpath(path, 'hgext.%s' % name)
  File "mercurial/extensions.py", line 83, in loadpath
    return imp.load_source(module_name, path)
  File ".../lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 675, in _load
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "hgext/journal.py", line 37, in <module>
    from . import share
ImportError: attempted relative import with no known parent package

This particular issue goes away if I use HGDEMANDIMPORT=disable, so I'm pretty
sure it's a dmeandimport problem. Note that you don't normally see the
traceback I pasted - you have to edit mercurial.extensions.disabledcmd's nested
findcmd function to not exit early if something goes wrong when it calls
loadpath() (instead force it to re-raise).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list