@@ -13,7 +13,7 @@ import semmle.python.essa.SsaDefinitions
1313private import semmle.python.types.Builtins
1414private import semmle.python.internal.CachedStages
1515
16- module BasePointsTo {
16+ deprecated module BasePointsTo {
1717 /** INTERNAL -- Use n.refersTo(value, _, origin) instead */
1818 pragma [ noinline]
1919 predicate points_to ( ControlFlowNode f , Object value , ControlFlowNode origin ) {
@@ -27,13 +27,13 @@ module BasePointsTo {
2727}
2828
2929/** Gets the kwargs parameter (`**kwargs`). In a function definition this is always a dict. */
30- predicate kwargs_points_to ( ControlFlowNode f , ClassObject cls ) {
30+ deprecated predicate kwargs_points_to ( ControlFlowNode f , ClassObject cls ) {
3131 exists ( Function func | func .getKwarg ( ) = f .getNode ( ) ) and
3232 cls = theDictType ( )
3333}
3434
3535/** Gets the varargs parameter (`*varargs`). In a function definition this is always a tuple. */
36- predicate varargs_points_to ( ControlFlowNode f , ClassObject cls ) {
36+ deprecated predicate varargs_points_to ( ControlFlowNode f , ClassObject cls ) {
3737 exists ( Function func | func .getVararg ( ) = f .getNode ( ) ) and
3838 cls = theTupleType ( )
3939}
@@ -45,7 +45,7 @@ predicate varargs_points_to(ControlFlowNode f, ClassObject cls) {
4545 * This exists primarily for internal use. Use getAnInferredType() instead.
4646 */
4747pragma [ noinline]
48- ClassObject simple_types ( Object obj ) {
48+ deprecated ClassObject simple_types ( Object obj ) {
4949 result = comprehension ( obj .getOrigin ( ) )
5050 or
5151 result = collection_literal ( obj .getOrigin ( ) )
@@ -59,7 +59,7 @@ ClassObject simple_types(Object obj) {
5959 obj = unknownValue ( ) and result = theUnknownType ( )
6060}
6161
62- private ClassObject comprehension ( Expr e ) {
62+ deprecated private ClassObject comprehension ( Expr e ) {
6363 e instanceof ListComp and result = theListType ( )
6464 or
6565 e instanceof SetComp and result = theSetType ( )
@@ -69,7 +69,7 @@ private ClassObject comprehension(Expr e) {
6969 e instanceof GeneratorExp and result = theGeneratorType ( )
7070}
7171
72- private ClassObject collection_literal ( Expr e ) {
72+ deprecated private ClassObject collection_literal ( Expr e ) {
7373 e instanceof List and result = theListType ( )
7474 or
7575 e instanceof Set and result = theSetType ( )
@@ -79,7 +79,7 @@ private ClassObject collection_literal(Expr e) {
7979 e instanceof Tuple and result = theTupleType ( )
8080}
8181
82- private int tuple_index_value ( Object t , int i ) {
82+ deprecated private int tuple_index_value ( Object t , int i ) {
8383 result = t .( TupleNode ) .getElement ( i ) .getNode ( ) .( Num ) .getN ( ) .toInt ( )
8484 or
8585 exists ( Object item |
@@ -89,7 +89,7 @@ private int tuple_index_value(Object t, int i) {
8989}
9090
9191pragma [ noinline]
92- int version_tuple_value ( Object t ) {
92+ deprecated int version_tuple_value ( Object t ) {
9393 not exists ( tuple_index_value ( t , 1 ) ) and result = tuple_index_value ( t , 0 ) * 10
9494 or
9595 not exists ( tuple_index_value ( t , 2 ) ) and
@@ -102,7 +102,7 @@ int version_tuple_value(Object t) {
102102}
103103
104104/** Choose a version numbers that represent the extreme of supported versions. */
105- private int major_minor ( ) {
105+ deprecated private int major_minor ( ) {
106106 if major_version ( ) = 3
107107 then (
108108 result = 33 or result = 37
@@ -113,7 +113,7 @@ private int major_minor() {
113113}
114114
115115/** Compares the given tuple object to both the maximum and minimum possible sys.version_info values */
116- int version_tuple_compare ( Object t ) {
116+ deprecated int version_tuple_compare ( Object t ) {
117117 version_tuple_value ( t ) < major_minor ( ) and result = - 1
118118 or
119119 version_tuple_value ( t ) = major_minor ( ) and result = 0
@@ -122,7 +122,7 @@ int version_tuple_compare(Object t) {
122122}
123123
124124/** Holds if `cls` is a new-style class if it were to have no explicit base classes */
125- predicate baseless_is_new_style ( ClassObject cls ) {
125+ deprecated predicate baseless_is_new_style ( ClassObject cls ) {
126126 cls .isBuiltin ( )
127127 or
128128 major_version ( ) = 3 and exists ( cls )
@@ -160,7 +160,7 @@ private predicate class_defines_name(Class cls, string name) {
160160}
161161
162162/** Gets a return value CFG node, provided that is safe to track across returns */
163- ControlFlowNode safe_return_node ( PyFunctionObject func ) {
163+ deprecated ControlFlowNode safe_return_node ( PyFunctionObject func ) {
164164 result = func .getAReturnedNode ( ) and
165165 // Not a parameter
166166 not exists ( Parameter p , SsaVariable pvar |
@@ -172,7 +172,7 @@ ControlFlowNode safe_return_node(PyFunctionObject func) {
172172}
173173
174174/** Holds if it can be determined from the control flow graph alone that this function can never return */
175- predicate function_can_never_return ( FunctionObject func ) {
175+ deprecated predicate function_can_never_return ( FunctionObject func ) {
176176 /*
177177 * A Python function never returns if it has no normal exits that are not dominated by a
178178 * call to a function which itself never returns.
@@ -188,7 +188,9 @@ predicate function_can_never_return(FunctionObject func) {
188188
189189/** Hold if outer contains inner, both are contained within a test and inner is a use is a plain use or an attribute lookup */
190190pragma [ noinline]
191- predicate contains_interesting_expression_within_test ( ControlFlowNode outer , ControlFlowNode inner ) {
191+ deprecated predicate contains_interesting_expression_within_test (
192+ ControlFlowNode outer , ControlFlowNode inner
193+ ) {
192194 inner .isLoad ( ) and
193195 exists ( ControlFlowNode test |
194196 outer .getAChild * ( ) = inner and
@@ -208,7 +210,7 @@ predicate test_contains(ControlFlowNode expr, ControlFlowNode use) {
208210}
209211
210212/** Holds if `test` is a test (a branch), `use` is within that test and `def` is an edge from that test with `sense` */
211- predicate refinement_test (
213+ deprecated predicate refinement_test (
212214 ControlFlowNode test , ControlFlowNode use , boolean sense , PyEdgeRefinement def
213215) {
214216 /*
@@ -224,7 +226,7 @@ predicate refinement_test(
224226
225227/** Holds if `f` is an import of the form `from .[...] import name` and the enclosing scope is an __init__ module */
226228pragma [ noinline]
227- predicate live_import_from_dot_in_init ( ImportMemberNode f , EssaVariable var ) {
229+ deprecated predicate live_import_from_dot_in_init ( ImportMemberNode f , EssaVariable var ) {
228230 exists ( string name |
229231 import_from_dot_in_init ( f .getModule ( name ) ) and
230232 var .getSourceVariable ( ) .getName ( ) = name and
@@ -249,13 +251,13 @@ Object undefinedVariable() { py_special_objects(result, "_semmle_undefined_value
249251/** Gets the pseudo-object representing an unknown value */
250252Object unknownValue ( ) { result .asBuiltin ( ) = Builtin:: unknown ( ) }
251253
252- BuiltinCallable theTypeNewMethod ( ) {
254+ deprecated BuiltinCallable theTypeNewMethod ( ) {
253255 result .asBuiltin ( ) = theTypeType ( ) .asBuiltin ( ) .getMember ( "__new__" )
254256}
255257
256258/** Gets the `value, cls, origin` that `f` would refer to if it has not been assigned some other value */
257259pragma [ noinline]
258- predicate potential_builtin_points_to (
260+ deprecated predicate potential_builtin_points_to (
259261 NameNode f , Object value , ClassObject cls , ControlFlowNode origin
260262) {
261263 f .isGlobal ( ) and
@@ -269,7 +271,7 @@ predicate potential_builtin_points_to(
269271}
270272
271273pragma [ noinline]
272- predicate builtin_name_points_to ( string name , Object value , ClassObject cls ) {
274+ deprecated predicate builtin_name_points_to ( string name , Object value , ClassObject cls ) {
273275 value = Object:: builtin ( name ) and cls .asBuiltin ( ) = value .asBuiltin ( ) .getClass ( )
274276}
275277
@@ -331,7 +333,9 @@ module BaseFlow {
331333}
332334
333335/** Points-to for syntactic elements where context is not relevant */
334- predicate simple_points_to ( ControlFlowNode f , Object value , ClassObject cls , ControlFlowNode origin ) {
336+ deprecated predicate simple_points_to (
337+ ControlFlowNode f , Object value , ClassObject cls , ControlFlowNode origin
338+ ) {
335339 kwargs_points_to ( f , cls ) and value = f and origin = f
336340 or
337341 varargs_points_to ( f , cls ) and value = f and origin = f
@@ -347,7 +351,9 @@ predicate simple_points_to(ControlFlowNode f, Object value, ClassObject cls, Con
347351 * Holds if `bit` is a binary expression node with a bitwise operator.
348352 * Helper for `this_binary_expr_points_to`.
349353 */
350- predicate bitwise_expression_node ( BinaryExprNode bit , ControlFlowNode left , ControlFlowNode right ) {
354+ deprecated predicate bitwise_expression_node (
355+ BinaryExprNode bit , ControlFlowNode left , ControlFlowNode right
356+ ) {
351357 exists ( Operator op | op = bit .getNode ( ) .getOp ( ) |
352358 op instanceof BitAnd or
353359 op instanceof BitOr or
@@ -357,13 +363,13 @@ predicate bitwise_expression_node(BinaryExprNode bit, ControlFlowNode left, Cont
357363 right = bit .getRight ( )
358364}
359365
360- private Module theCollectionsAbcModule ( ) {
366+ deprecated private Module theCollectionsAbcModule ( ) {
361367 result .getName ( ) = "_abcoll"
362368 or
363369 result .getName ( ) = "_collections_abc"
364370}
365371
366- ClassObject collectionsAbcClass ( string name ) {
372+ deprecated ClassObject collectionsAbcClass ( string name ) {
367373 exists ( Class cls |
368374 result .getPyClass ( ) = cls and
369375 cls .getName ( ) = name and
0 commit comments