diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | modutils.py | 11 |
2 files changed, 17 insertions, 3 deletions
@@ -2,8 +2,13 @@ ChangeLog for logilab.common ============================ -- - * modutils: fix typo causing name error in python3 / bad message in python2 - (#136037) + * modutils: + + * fix typo causing name error in python3 / bad message in python2 + (#136037) + + * fix python3.3 crash in file_from_modpath due to implementation + change of imp.find_module wrt builtin modules (#137244) 2013-04-16 -- 0.59.1 diff --git a/modutils.py b/modutils.py index c792847..05f0602 100644 --- a/modutils.py +++ b/modutils.py @@ -606,6 +606,15 @@ def _module_file(modpath, path=None): checkeggs = False imported = [] while modpath: + # take care to changes in find_module implementation wrt builtin modules + # + # Python 2.6.6 (r266:84292, Sep 11 2012, 08:34:23) + # >>> imp.find_module('posix') + # (None, 'posix', ('', '', 6)) + # + # Python 3.3.1 (default, Apr 26 2013, 12:08:46) + # >>> imp.find_module('posix') + # (None, None, ('', '', 6)) try: _, mp_filename, mp_desc = find_module(modpath[0], path) except ImportError: @@ -613,7 +622,7 @@ def _module_file(modpath, path=None): return _search_zip(modpath, pic)[:2] raise else: - if checkeggs: + if checkeggs and mp_filename: fullabspath = [abspath(x) for x in _path] try: pathindex = fullabspath.index(dirname(abspath(mp_filename))) |