Python: Port DeprecatedSliceMethod.ql

Only trivial test changes.
This commit is contained in:
Taus
2026-02-23 15:51:25 +00:00
parent 50b3b7ee1f
commit 3584ad1905
2 changed files with 9 additions and 8 deletions

View File

@@ -10,16 +10,17 @@
*/
import python
private import LegacyPointsTo
private import semmle.python.dataflow.new.internal.DataFlowDispatch
predicate slice_method_name(string name) {
name = "__getslice__" or name = "__setslice__" or name = "__delslice__"
}
from PythonFunctionValue f, string meth
from Function f, string meth
where
f.getScope().isMethod() and
not f.isOverridingMethod() and
f.isMethod() and
slice_method_name(meth) and
f.getName() = meth
f.getName() = meth and
not DuckTyping::overridesMethod(f) and
not DuckTyping::hasUnresolvedBase(getADirectSuperclass*(f.getScope()))
select f, meth + " method has been deprecated since Python 2.0."