Python points-to: update some more test results.

This commit is contained in:
Mark Shannon
2019-05-10 16:05:37 +01:00
parent 76c43b491f
commit 8b28105677
2 changed files with 17 additions and 10 deletions

View File

@@ -1,3 +1,5 @@
WARNING: Predicate getSource has been deprecated and may be removed in future (TestEvaluate.ql:14,16-25)
WARNING: Predicate getSource has been deprecated and may be removed in future (TestEvaluate.ql:16,20-29)
| b_condition.py:7 | Compare | true | x | NoneType None |
| b_condition.py:13 | Compare | false | x | NoneType None |
| b_condition.py:19 | UnaryExpr | true | x | NoneType None |
@@ -33,16 +35,6 @@
| c_tests.py:26 | Compare | true | x | Tuple |
| c_tests.py:29 | isinstance() | false | x | List |
| c_tests.py:29 | isinstance() | true | x | Tuple |
| c_tests.py:34 | Compare | true | Attribute | NoneType None |
| c_tests.py:39 | Attribute | false | Attribute | int 0 |
| c_tests.py:39 | Attribute | true | Attribute | int 1 |
| c_tests.py:44 | Compare | false | Attribute | int 1 |
| c_tests.py:44 | Compare | true | Attribute | int 0 |
| c_tests.py:50 | isinstance() | false | Attribute | List |
| c_tests.py:50 | isinstance() | true | Attribute | Tuple |
| c_tests.py:53 | Compare | false | Attribute | Tuple |
| c_tests.py:53 | Compare | true | Attribute | List |
| c_tests.py:53 | Compare | true | Attribute | Tuple |
| c_tests.py:60 | issubclass() | false | x | builtin-class type |
| c_tests.py:60 | issubclass() | true | x | builtin-class bool |
| c_tests.py:65 | hasattr() | false | x | builtin-class float |

View File

@@ -1,4 +1,5 @@
import python
import semmle.python.objects.ObjectInternal
bindingset[which]
string locate(Location l, string which) {
@@ -28,3 +29,17 @@ string repr(Object o) {
or
o = theBoundMethodType() and result = "builtin-class method"
}
predicate long_tuple(Value v) {
v.(TupleObjectInternal).length() > 3
}
string vrepr(Value v) {
/* Work around differing names in 2/3 */
not v = ObjectInternal::boundMethod() and
not long_tuple(v) and result = v.toString()
or
v = ObjectInternal::boundMethod() and result = "builtin-class method"
or
long_tuple(v) and result = "(..., ...)"
}