Mercurial 4.2 extension import issue

Sébastien Pierre sebastien.pierre at gmail.com
Fri Jul 28 14:39:28 UTC 2017


Hi there,

I'm running Mercurial 4.2 with Fedora 26 and ran into the following issue.
Assuming you have the `urwid` python module installed, do the following:

echo "import urwid;a=urwid.widget" > ~/hgfail.py

and then add

[extensions]
fail = ~/hgfail.py

then do `hg --version` and then I get this

*** failed to import extension fail from ~/hgfail.py: cannot import name
command_map

I've asked coworkers to test this and this works with older versions of
Mercurial. The full backtrace hints at a potential bug with mercurial's
custom import functions:

*** failed to import extension fail from ~/hgfail.py: cannot import name
command_map
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/mercurial/extensions.py", line
173, in loadall
    load(ui, name, path)
  File "/usr/lib64/python2.7/site-packages/mercurial/extensions.py", line
131, in load
    mod = _importext(name, path, bind(_reportimporterror, ui))
  File "/usr/lib64/python2.7/site-packages/mercurial/extensions.py", line
93, in _importext
    mod = loadpath(path, 'hgext.%s' % name)
  File "/usr/lib64/python2.7/site-packages/mercurial/extensions.py", line
74, in loadpath
    return imp.load_source(module_name, path)
  File "/home/sebastien/hgfail.py", line 1, in <module>
    import urwid;a=urwid.widget
  File "/usr/lib64/python2.7/site-packages/mercurial/demandimport.py", line
152, in __getattribute__
    self._load()
  File "/usr/lib64/python2.7/site-packages/mercurial/demandimport.py", line
100, in _load
    mod = _hgextimport(_import, head, globals, locals, None, level)
  File "/usr/lib64/python2.7/site-packages/mercurial/demandimport.py", line
53, in _hgextimport
    return importfunc(name, globals, *args, **kwargs)
  File
"/home/sebastien/.local/lib/python2.7/site-packages/urwid/__init__.py",
line 55, in <module>
    from urwid.main_loop import (ExitMainLoop, MainLoop, SelectEventLoop,
  File "/usr/lib64/python2.7/site-packages/mercurial/demandimport.py", line
260, in _demandimport
    mod = _hgextimport(_origimport, name, globals, locals)
  File "/usr/lib64/python2.7/site-packages/mercurial/demandimport.py", line
53, in _hgextimport
    return importfunc(name, globals, *args, **kwargs)
  File
"/home/sebastien/.local/lib/python2.7/site-packages/urwid/main_loop.py",
line 39, in <module>
    from urwid.command_map import command_map, REDRAW_SCREEN
ImportError: cannot import name command_map

Can anyone confirm this problem?

Thanks,

-- Sébastien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial/attachments/20170728/6f45a931/attachment.html>


More information about the Mercurial mailing list