Merge pull request #2401 from tausbn/python-fix-non-iterable-class-confusion-fp

Python: Fix false positive in `py/non-iterator-in-for-loop`
This commit is contained in:
Rasmus Wriedt Larsen
2019-11-22 11:15:16 +01:00
committed by GitHub
3 changed files with 3 additions and 3 deletions

View File

@@ -367,9 +367,10 @@ predicate receiver(AttrNode instantiation, PointsToContext context, ObjectIntern
pragma [noinline]
private predicate self_parameter(ParameterDefinition def, PointsToContext context, PythonClassObjectInternal cls) {
def.isSelf() and
/* Exclude the special parameter name `.0` which is used for unfolded comprehensions. */
def.getName() != ".0" and
exists(Function scope |
def.getScope() = scope and
def.isSelf() and
context.isRuntime() and context.appliesToScope(scope) and
scope.getScope() = cls.getScope() and
concrete_class(cls) and