summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--checkers/imports.py8
2 files changed, 9 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 922b49d..064bce9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,7 +5,8 @@ ChangeLog for PyLint
* fix #3733: Messages (dis)appear depending on order of file names
* fix #4026: pylint.el should require compile
* implement #4012: flag back tick as deprecated (new W0333 message)
-
+ * applied patch from Stefan Rank to avoid W0410 false positive when
+ multiple "from __future__" import statements
2007-06-07 -- 0.13.2
* fix disable-checker option so that it won't accidentally enable the
@@ -13,7 +14,7 @@ ChangeLog for PyLint
* added note about the gedit plugin into documentation
2007-03-02 -- 0.13.1
- * fix some unexplained 0.13.0 packaging issue which led a bunch of
+ * fix some unexplained 0.13.0 packaging issue which led to a bunch of
files missing from the distribution
2007-02-28 -- 0.13.0
diff --git a/checkers/imports.py b/checkers/imports.py
index 921d8b6..40a7d97 100644
--- a/checkers/imports.py
+++ b/checkers/imports.py
@@ -246,8 +246,12 @@ given file (report R0402 must not be disabled)'}
basename = node.modname
if basename == '__future__':
# check this is the first non docstring statement in the module
- if node.previous_sibling():
- self.add_message('W0410', node=node)
+ prev = node.previous_sibling()
+ if prev:
+ # consecutive future statements are possible
+ if not(isinstance(prev, astng.From)
+ and prev.modname == '__future__'):
+ self.add_message('W0410', node=node)
self._check_deprecated(node, basename)
relative = self._check_relative(node, basename)
for name, _ in node.names: