mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
Python: Support super().__new__(cls)
This commit is contained in:
@@ -21,6 +21,9 @@ pointsTo_found_typeTracker_notFound
|
||||
| code/type_tracking_limitation.py:8:1:8:3 | ControlFlowNode for x() | my_func |
|
||||
typeTracker_found_pointsTo_notFound
|
||||
| code/callable_as_argument.py:29:5:29:12 | ControlFlowNode for Attribute() | test_class.InsideTestFunc.sm |
|
||||
| code/class_construction.py:44:9:44:26 | ControlFlowNode for Attribute() | WithNew.some_method |
|
||||
| code/class_construction.py:61:9:61:26 | ControlFlowNode for Attribute() | WithNew.some_method |
|
||||
| code/class_construction.py:75:9:75:27 | ControlFlowNode for Attribute() | ExtraCallToInit.__init__ |
|
||||
| code/class_special_methods.py:22:9:22:16 | ControlFlowNode for self() | Base.__call__ |
|
||||
| code/class_special_methods.py:22:9:22:16 | ControlFlowNode for self() | Sub.__call__ |
|
||||
| code/class_special_methods.py:33:1:33:5 | ControlFlowNode for b() | Base.__call__ |
|
||||
|
||||
@@ -41,7 +41,7 @@ class WithNew(object):
|
||||
print("WithNew.__new__", arg)
|
||||
inst = super().__new__(cls)
|
||||
assert isinstance(inst, cls)
|
||||
inst.some_method() # $ MISSING: pt,tt=WithNew.some_method
|
||||
inst.some_method() # $ tt=WithNew.some_method
|
||||
return inst
|
||||
|
||||
def __init__(self, arg=None):
|
||||
@@ -58,7 +58,7 @@ class WithNewSub(WithNew):
|
||||
print("WithNewSub.__new__")
|
||||
inst = super().__new__(cls, 44.1) # $ pt,tt=WithNew.__new__
|
||||
assert isinstance(inst, cls)
|
||||
inst.some_method() # $ MISSING: pt,tt=WithNew.some_method
|
||||
inst.some_method() # $ tt=WithNew.some_method
|
||||
return inst
|
||||
|
||||
WithNewSub() # $ tt=WithNewSub.__new__ tt=WithNew.__init__
|
||||
@@ -72,7 +72,7 @@ class ExtraCallToInit(object):
|
||||
inst = super().__new__(cls)
|
||||
assert isinstance(inst, cls)
|
||||
# you're not supposed to do this, since it will cause the __init__ method will be run twice.
|
||||
inst.__init__(1001) # $ MISSING: pt,tt=ExtraCallToInit.__init__
|
||||
inst.__init__(1001) # $ tt=ExtraCallToInit.__init__
|
||||
return inst
|
||||
|
||||
def __init__(self, arg):
|
||||
|
||||
Reference in New Issue
Block a user