CodeQL library for Python
codeql/python-all 0.11.12 (changelog, source)
Search

Predicate iterable_unpacking_descent

Helper predicate for taintedMultiAssignment

Returns the depth the elements that are assigned to left_defn with iterable unpacking has, compared to left_parent. Special care is taken for StarredNode that is assigned a sequence of items.

For example, ((x, *y), ...) = value with any nesting on LHS

  • with left_defn = x, left_parent = (x, *y), result = 1
  • with left_defn = x, left_parent = ((x, *y), ...), result = 2
  • with left_defn = *y, left_parent = (x, *y), result = 0
  • with left_defn = *y, left_parent = ((x, *y), ...), result = 1

Import path

import semmle.python.dataflow.old.Implementation
int iterable_unpacking_descent(SequenceNode left_parent, ControlFlowNode left_defn)