# HG changeset patch # User FUJIWARA Katsunori # Date 2016-06-18 17:15:09 # Node ID 7712fcde2d56695eb0f5ce425388b15ad39bf3ee # Parent 36fbd72c2f39fef8ad52d7c559906c2bc388760c import-checker: increase portability for python 2.6.x Before this patch, fromlocalfunc() assumes that "module" attribute of ast.ImportFrom is None for "from . import a", and Python 2.7.x satisfies this assumption. On the other hand, with Python 2.6.x, "module" attribute of ast.ImportFrom is an empty string for "from . import a", and this causes failure of test-check-module-imports.t. diff --git a/contrib/import-checker.py b/contrib/import-checker.py --- a/contrib/import-checker.py +++ b/contrib/import-checker.py @@ -141,8 +141,8 @@ def fromlocalfunc(modulename, localmods) if prefix: prefix += '.' def fromlocal(name, level=0): - # name is None when relative imports are used. - if name is None: + # name is false value when relative imports are used. + if not name: # If relative imports are used, level must not be absolute. assert level > 0 candidates = ['.'.join(modulename.split('.')[:-level])]