fix false positives with py >= 2.5

This commit is contained in:
Sylvain Thénault 2006-09-23 14:00:03 +02:00
parent 2a35230588
commit 67f5a8462b
2 changed files with 6 additions and 5 deletions

View File

@ -327,7 +327,8 @@ functions, methods
self.add_message('W0105', node=node)
return
# ignore if this is a function call (can't predicate side effects)
if not isinstance(node.expr, astng.CallFunc):
# or a yield (which are wrapped by a discard node in py >= 2.5)
if not isinstance(node.expr, (astng.CallFunc, astng.Yield)):
self.add_message('W0104', node=node)
def visit_function(self, node):

View File

@ -16,7 +16,7 @@
"""check for new / old style related problems
"""
__revision__ = "$Id: newstyle.py,v 1.8 2006-03-05 14:39:38 syt Exp $"
import sys
from logilab import astng
@ -32,8 +32,8 @@ MSGS = {
'Used when another argument than the current class is given as \
first argument of the super builtin.'),
'E1010': ('Raising a new style class',
'Used when a new style class is raised since it\'s not yet \
possible.'),
'Used when a new style class is raised since it\'s not \
possible with python < 2.5.'),
'W1001': ('Use of "property" on an old style class',
'Used when PyLint detect the use of the builtin "property" \
@ -96,7 +96,7 @@ class NewStyleConflictChecker(BaseChecker):
pass
else:
if isinstance(value, astng.Class):
if value.newstyle:
if value.newstyle and sys.version_info < (2, 5):
self.add_message('E1010', node=node)
elif not inherit_from_std_ex(value):
self.add_message('W1010', node=node)