summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2013-05-07 14:46:28 +0200
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2013-05-07 14:46:28 +0200
commitef345bf9d8664d5addfd0ef627b1f6d569f311fb (patch)
tree5d1aa12dedf93469ae3b6b6a6e04b386adf85c6a
parent259fac24fdc0b990678be0748528b8b302e2058e (diff)
downloadlogilab-common-ef345bf9d8664d5addfd0ef627b1f6d569f311fb.tar.gz
[modutils]?fix python3.3 crash on file_from_modpath. Closes #137244
-rw-r--r--ChangeLog9
-rw-r--r--modutils.py11
2 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 8ee6eac..b0c893e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)))