We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
DuckTyping::hasUnreliableMro
1 parent fa8e4f7 commit 50b3b7eCopy full SHA for 50b3b7e
1 file changed
python/ql/lib/semmle/python/dataflow/new/internal/DataFlowDispatch.qll
@@ -2118,6 +2118,19 @@ module DuckTyping {
2118
*/
2119
Function getInit(Class cls) { result = invokedFunctionFromClassConstruction(cls, "__init__") }
2120
2121
+ /**
2122
+ * Holds if `cls` or any of its superclasses uses multiple inheritance, or
2123
+ * has an unresolved base class. In these cases, our MRO approximation may
2124
+ * resolve to the wrong `__init__`, so we should not flag argument mismatches.
2125
+ */
2126
+ predicate hasUnreliableMro(Class cls) {
2127
+ exists(Class sup | sup = getADirectSuperclass*(cls) |
2128
+ exists(sup.getBase(1))
2129
+ or
2130
+ hasUnresolvedBase(sup)
2131
+ )
2132
+ }
2133
+
2134
/**
2135
* Holds if `f` overrides a method in a superclass with the same name.
2136
0 commit comments