Skip to content

Commit

Permalink
Merge pull request #16804 from github/tausbn/python-fix-bad-join-in-d…
Browse files Browse the repository at this point in the history
…ataflow-dispatch

Python: Fix bad join in `DataFlowDispatch`
  • Loading branch information
tausbn authored Jul 1, 2024
2 parents c6d02e4 + 6db7e72 commit d9b337c
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -829,10 +829,16 @@ Function findFunctionAccordingToMro(Class cls, string name) {
result = cls.getAMethod() and
result.getName() = name
or
not cls.getAMethod().getName() = name and
not class_has_method(cls, name) and
result = findFunctionAccordingToMro(getNextClassInMro(cls), name)
}

/**
* Join-order helper for `findFunctionAccordingToMro` and `findFunctionAccordingToMroKnownStartingClass`.
*/
pragma[nomagic]
private predicate class_has_method(Class cls, string name) { cls.getAMethod().getName() = name }

/**
* Gets a class that, from an approximated MRO calculation, might be the next class
* after `cls` in the MRO for `startingClass`.
Expand Down Expand Up @@ -860,7 +866,7 @@ private Function findFunctionAccordingToMroKnownStartingClass(
result.getName() = name and
cls = getADirectSuperclass*(startingClass)
or
not cls.getAMethod().getName() = name and
not class_has_method(cls, name) and
result =
findFunctionAccordingToMroKnownStartingClass(getNextClassInMroKnownStartingClass(cls,
startingClass), startingClass, name)
Expand Down

0 comments on commit d9b337c

Please sign in to comment.