File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
python/ql/lib/semmle/python/dataflow/new/internal Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -2118,6 +2118,19 @@ module DuckTyping {
21182118 */
21192119 Function getInit ( Class cls ) { result = invokedFunctionFromClassConstruction ( cls , "__init__" ) }
21202120
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+
21212134 /**
21222135 * Holds if `f` overrides a method in a superclass with the same name.
21232136 */
You can’t perform that action at this time.
0 commit comments