changeset 29374:7712fcde2d56

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.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 19 Jun 2016 02:15:09 +0900
parents 36fbd72c2f39
children fcaf20175b1b
files contrib/import-checker.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/import-checker.py	Fri Jun 17 20:06:09 2016 +0100
+++ b/contrib/import-checker.py	Sun Jun 19 02:15:09 2016 +0900
@@ -141,8 +141,8 @@
     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])]