fix absolute import behaviour with python 2.7: it seems that absolute import are actually not activated by default, at least with 2.7.1

authorSylvain Thénault <sylvain.thenault@logilab.fr>
changeset77c1171bcace
branchdefault
phasepublic
hiddenno
parent revision#c8f6995834aa closes #70565: absolute imports treated as relative (patch by Jacek Konieczny)
child revision#5bc62366ccda cleanups
files modified by this revision
scoped_nodes.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1310133338 -7200
# Fri Jul 08 15:55:38 2011 +0200
# Node ID 77c1171bcace0c40991635778559efcc9468f197
# Parent c8f6995834aafcf01879ae1a8076d454b2305941
fix absolute import behaviour with python 2.7: it seems that absolute import are actually not activated by default, at least with 2.7.1

diff --git a/scoped_nodes.py b/scoped_nodes.py
@@ -1,6 +1,6 @@
1 -# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
2 +# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
3  # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
4  # copyright 2003-2010 Sylvain Thenault, all rights reserved.
5  # contact mailto:thenault@gmail.com
6  #
7  # This file is part of logilab-astng.
@@ -311,11 +311,11 @@
8 
9      def next_sibling(self):
10          """module has no sibling"""
11          return
12 
13 -    if sys.version_info < (2, 7):
14 +    if sys.version_info < (2, 8):
15          def absolute_import_activated(self):
16              for stmt in self.locals.get('absolute_import', ()):
17                  if isinstance(stmt, From) and stmt.modname == '__future__':
18                      return True
19              return False