mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
Python: Use object as default return type for built-ins.
This commit is contained in:
@@ -333,10 +333,19 @@ class BuiltinMethodObjectInternal extends CallableObjectInternal, TBuiltinMethod
|
||||
}
|
||||
|
||||
Builtin getReturnType() {
|
||||
/* If we have a record of the return type in our stubs, use that. */
|
||||
exists(Builtin func |
|
||||
func = this.getBuiltin() |
|
||||
ext_rettype(func, result)
|
||||
)
|
||||
or
|
||||
/* Otherwise, if no such record exists, use `object` as the return type. */
|
||||
not exists(Builtin func |
|
||||
// We cannot do `this.getBuiltin()` here, as that would introduce negative recursion.
|
||||
// Instead, we appeal directly to the underlying IPA type.
|
||||
this = TBuiltinMethodObject(func) and
|
||||
ext_rettype(func, _))
|
||||
and result = Builtin::builtin("object")
|
||||
}
|
||||
|
||||
override ControlFlowNode getOrigin() {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
| l_calls.py:64 | ControlFlowNode for d |
|
||||
|
||||
@@ -292,6 +292,7 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
|
||||
| g_class_init.py:35 | ControlFlowNode for super | builtin-class super | builtin-class type | 35 | runtime |
|
||||
| g_class_init.py:35 | ControlFlowNode for super() | super() | builtin-class super | 35 | runtime |
|
||||
| g_class_init.py:36 | ControlFlowNode for Attribute | super().__init__ | builtin-class method | 36 | runtime |
|
||||
| g_class_init.py:36 | ControlFlowNode for Attribute() | Attribute() | builtin-class object | 36 | runtime |
|
||||
| g_class_init.py:36 | ControlFlowNode for D | class D | builtin-class type | 32 | runtime |
|
||||
| g_class_init.py:36 | ControlFlowNode for self | self | class D | 34 | runtime |
|
||||
| g_class_init.py:36 | ControlFlowNode for super | builtin-class super | builtin-class type | 36 | runtime |
|
||||
@@ -727,13 +728,16 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
|
||||
| l_calls.py:62 | ControlFlowNode for c | Builtin-method get | builtin-class method_descriptor | 62 | import |
|
||||
| l_calls.py:62 | ControlFlowNode for dict | builtin-class dict | builtin-class type | 62 | import |
|
||||
| l_calls.py:63 | ControlFlowNode for Attribute | Builtin-method get | builtin-class method_descriptor | 63 | import |
|
||||
| l_calls.py:63 | ControlFlowNode for Attribute() | Attribute() | builtin-class object | 63 | import |
|
||||
| l_calls.py:63 | ControlFlowNode for Dict | Dict | builtin-class dict | 63 | import |
|
||||
| l_calls.py:63 | ControlFlowNode for IntegerLiteral | int 5 | builtin-class int | 63 | import |
|
||||
| l_calls.py:63 | ControlFlowNode for Str | 'foo' | builtin-class str | 63 | import |
|
||||
| l_calls.py:63 | ControlFlowNode for d | Attribute() | builtin-class object | 63 | import |
|
||||
| l_calls.py:63 | ControlFlowNode for dict | builtin-class dict | builtin-class type | 63 | import |
|
||||
| l_calls.py:64 | ControlFlowNode for a | Builtin-method bit_length | builtin-class method_descriptor | 58 | import |
|
||||
| l_calls.py:64 | ControlFlowNode for b | Attribute() | builtin-class int | 59 | import |
|
||||
| l_calls.py:64 | ControlFlowNode for c | Builtin-method get | builtin-class method_descriptor | 62 | import |
|
||||
| l_calls.py:64 | ControlFlowNode for d | Attribute() | builtin-class object | 63 | import |
|
||||
| m_attributes.py:3 | ControlFlowNode for C | class C | builtin-class type | 3 | import |
|
||||
| m_attributes.py:3 | ControlFlowNode for ClassExpr | class C | builtin-class type | 3 | import |
|
||||
| m_attributes.py:3 | ControlFlowNode for object | builtin-class object | builtin-class type | 3 | import |
|
||||
@@ -880,6 +884,8 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
|
||||
| q_super.py:3 | ControlFlowNode for __init__ | Function __init__ | builtin-class function | 3 | import |
|
||||
| q_super.py:4 | ControlFlowNode for Attribute | super().__init__ | builtin-class method | 4 | code/q_super.py:12 from runtime |
|
||||
| q_super.py:4 | ControlFlowNode for Attribute | super().__init__ | builtin-class method | 4 | runtime |
|
||||
| q_super.py:4 | ControlFlowNode for Attribute() | Attribute() | builtin-class object | 4 | code/q_super.py:12 from runtime |
|
||||
| q_super.py:4 | ControlFlowNode for Attribute() | Attribute() | builtin-class object | 4 | runtime |
|
||||
| q_super.py:4 | ControlFlowNode for Base2 | class Base2 | builtin-class type | 1 | code/q_super.py:12 from runtime |
|
||||
| q_super.py:4 | ControlFlowNode for Base2 | class Base2 | builtin-class type | 1 | runtime |
|
||||
| q_super.py:4 | ControlFlowNode for self | self | class Base2 | 3 | runtime |
|
||||
@@ -1049,6 +1055,7 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
|
||||
| q_super.py:75 | ControlFlowNode for i | super().__init__ | builtin-class method | 75 | runtime |
|
||||
| q_super.py:75 | ControlFlowNode for s | super() | builtin-class super | 74 | runtime |
|
||||
| q_super.py:76 | ControlFlowNode for i | super().__init__ | builtin-class method | 75 | runtime |
|
||||
| q_super.py:76 | ControlFlowNode for i() | i() | builtin-class object | 76 | runtime |
|
||||
| r_regressions.py:5 | ControlFlowNode for ClassExpr | class Queue | builtin-class type | 5 | import |
|
||||
| r_regressions.py:5 | ControlFlowNode for Queue | class Queue | builtin-class type | 5 | import |
|
||||
| r_regressions.py:5 | ControlFlowNode for object | builtin-class object | builtin-class type | 5 | import |
|
||||
|
||||
@@ -405,6 +405,7 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
|
||||
| g_class_init.py:35 | ControlFlowNode for super | builtin-class super | builtin-class type | 35 |
|
||||
| g_class_init.py:35 | ControlFlowNode for super() | super() | builtin-class super | 35 |
|
||||
| g_class_init.py:36 | ControlFlowNode for Attribute | super().__init__ | builtin-class method | 36 |
|
||||
| g_class_init.py:36 | ControlFlowNode for Attribute() | Attribute() | builtin-class object | 36 |
|
||||
| g_class_init.py:36 | ControlFlowNode for D | class D | builtin-class type | 32 |
|
||||
| g_class_init.py:36 | ControlFlowNode for self | self | class D | 34 |
|
||||
| g_class_init.py:36 | ControlFlowNode for super | builtin-class super | builtin-class type | 36 |
|
||||
@@ -800,13 +801,16 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
|
||||
| l_calls.py:62 | ControlFlowNode for c | Builtin-method get | builtin-class method_descriptor | 62 |
|
||||
| l_calls.py:62 | ControlFlowNode for dict | builtin-class dict | builtin-class type | 62 |
|
||||
| l_calls.py:63 | ControlFlowNode for Attribute | Builtin-method get | builtin-class method_descriptor | 63 |
|
||||
| l_calls.py:63 | ControlFlowNode for Attribute() | Attribute() | builtin-class object | 63 |
|
||||
| l_calls.py:63 | ControlFlowNode for Dict | Dict | builtin-class dict | 63 |
|
||||
| l_calls.py:63 | ControlFlowNode for IntegerLiteral | int 5 | builtin-class int | 63 |
|
||||
| l_calls.py:63 | ControlFlowNode for Str | 'foo' | builtin-class str | 63 |
|
||||
| l_calls.py:63 | ControlFlowNode for d | Attribute() | builtin-class object | 63 |
|
||||
| l_calls.py:63 | ControlFlowNode for dict | builtin-class dict | builtin-class type | 63 |
|
||||
| l_calls.py:64 | ControlFlowNode for a | Builtin-method bit_length | builtin-class method_descriptor | 58 |
|
||||
| l_calls.py:64 | ControlFlowNode for b | Attribute() | builtin-class int | 59 |
|
||||
| l_calls.py:64 | ControlFlowNode for c | Builtin-method get | builtin-class method_descriptor | 62 |
|
||||
| l_calls.py:64 | ControlFlowNode for d | Attribute() | builtin-class object | 63 |
|
||||
| s_scopes.py:4 | ControlFlowNode for True | bool True | builtin-class bool | 4 |
|
||||
| s_scopes.py:4 | ControlFlowNode for float | bool True | builtin-class bool | 4 |
|
||||
| s_scopes.py:7 | ControlFlowNode for C2 | class C2 | builtin-class type | 7 |
|
||||
|
||||
@@ -232,6 +232,7 @@
|
||||
| g_class_init.py:35 | ControlFlowNode for super | runtime | builtin-class super | builtin-class type |
|
||||
| g_class_init.py:35 | ControlFlowNode for super() | runtime | super(class D, self instance of D) | builtin-class super |
|
||||
| g_class_init.py:36 | ControlFlowNode for Attribute | runtime | Method(builtin method __init__, self instance of D) | builtin-class method |
|
||||
| g_class_init.py:36 | ControlFlowNode for Attribute() | runtime | instance of object | builtin-class object |
|
||||
| g_class_init.py:36 | ControlFlowNode for D | runtime | class D | builtin-class type |
|
||||
| g_class_init.py:36 | ControlFlowNode for self | runtime | self instance of D | class D |
|
||||
| g_class_init.py:36 | ControlFlowNode for super | runtime | builtin-class super | builtin-class type |
|
||||
@@ -584,6 +585,7 @@
|
||||
| l_calls.py:62 | ControlFlowNode for Attribute | import | builtin method get | builtin-class method_descriptor |
|
||||
| l_calls.py:62 | ControlFlowNode for dict | import | builtin-class dict | builtin-class type |
|
||||
| l_calls.py:63 | ControlFlowNode for Attribute | import | builtin method get | builtin-class method_descriptor |
|
||||
| l_calls.py:63 | ControlFlowNode for Attribute() | import | instance of object | builtin-class object |
|
||||
| l_calls.py:63 | ControlFlowNode for Dict | import | Dict | builtin-class dict |
|
||||
| l_calls.py:63 | ControlFlowNode for IntegerLiteral | import | int 5 | builtin-class int |
|
||||
| l_calls.py:63 | ControlFlowNode for Str | import | 'foo' | builtin-class str |
|
||||
@@ -591,6 +593,7 @@
|
||||
| l_calls.py:64 | ControlFlowNode for a | import | builtin method bit_length | builtin-class method_descriptor |
|
||||
| l_calls.py:64 | ControlFlowNode for b | import | instance of int | builtin-class int |
|
||||
| l_calls.py:64 | ControlFlowNode for c | import | builtin method get | builtin-class method_descriptor |
|
||||
| l_calls.py:64 | ControlFlowNode for d | import | instance of object | builtin-class object |
|
||||
| m_attributes.py:3 | ControlFlowNode for ClassExpr | import | class C | builtin-class type |
|
||||
| m_attributes.py:3 | ControlFlowNode for object | import | builtin-class object | builtin-class type |
|
||||
| m_attributes.py:5 | ControlFlowNode for FunctionExpr | import | Function C.__init__ | builtin-class function |
|
||||
@@ -702,6 +705,8 @@
|
||||
| q_super.py:3 | ControlFlowNode for FunctionExpr | import | Function Base2.__init__ | builtin-class function |
|
||||
| q_super.py:4 | ControlFlowNode for Attribute | code/q_super.py:12 from runtime | Method(builtin method __init__, self instance of Derived4) | builtin-class method |
|
||||
| q_super.py:4 | ControlFlowNode for Attribute | runtime | Method(builtin method __init__, self instance of Base2) | builtin-class method |
|
||||
| q_super.py:4 | ControlFlowNode for Attribute() | code/q_super.py:12 from runtime | instance of object | builtin-class object |
|
||||
| q_super.py:4 | ControlFlowNode for Attribute() | runtime | instance of object | builtin-class object |
|
||||
| q_super.py:4 | ControlFlowNode for Base2 | code/q_super.py:12 from runtime | class Base2 | builtin-class type |
|
||||
| q_super.py:4 | ControlFlowNode for Base2 | runtime | class Base2 | builtin-class type |
|
||||
| q_super.py:4 | ControlFlowNode for self | code/q_super.py:12 from runtime | self instance of Derived4 | class Derived4 |
|
||||
@@ -842,6 +847,7 @@
|
||||
| q_super.py:75 | ControlFlowNode for Attribute | runtime | Method(builtin method __init__, self instance of M) | builtin-class method |
|
||||
| q_super.py:75 | ControlFlowNode for s | runtime | super(class M, self instance of M) | builtin-class super |
|
||||
| q_super.py:76 | ControlFlowNode for i | runtime | Method(builtin method __init__, self instance of M) | builtin-class method |
|
||||
| q_super.py:76 | ControlFlowNode for i() | runtime | instance of object | builtin-class object |
|
||||
| r_regressions.py:5 | ControlFlowNode for ClassExpr | import | class Queue | builtin-class type |
|
||||
| r_regressions.py:5 | ControlFlowNode for object | import | builtin-class object | builtin-class type |
|
||||
| r_regressions.py:7 | ControlFlowNode for FunctionExpr | import | Function Queue.__init__ | builtin-class function |
|
||||
|
||||
Reference in New Issue
Block a user