mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Add additional test case + update missing del tests
This commit is contained in:
@@ -1 +1 @@
|
||||
| missing_del.py:12:1:12:13 | class X3 | Class X3 may not be cleaned up properly as $@ is not called during deletion. | missing_del.py:9:5:9:22 | Function __del__ | method X2.__del__ |
|
||||
| missing_del.py:13:1:13:13 | Class X3 | This class does not call $@ during destruction. ($@ may be missing a call to a base class __del__) | missing_del.py:9:5:9:22 | Function __del__ | X2.__del__ | missing_del.py:15:5:15:22 | Function __del__ | X3.__del__ |
|
||||
|
||||
@@ -2,14 +2,19 @@
|
||||
class X1(object):
|
||||
|
||||
def __del__(self):
|
||||
pass
|
||||
print("X1 del")
|
||||
|
||||
class X2(X1):
|
||||
|
||||
def __del__(self):
|
||||
print("X2 del")
|
||||
X1.__del__(self)
|
||||
|
||||
class X3(X2):
|
||||
class X3(X2): # $ Alert - skips X2 del
|
||||
|
||||
def __del__(self):
|
||||
print("X3 del")
|
||||
X1.__del__(self)
|
||||
|
||||
a = X3()
|
||||
del a
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
| missing_init.py:14:5:14:23 | Function __init__ | This initialization method does not call $@, which may leave $@ partially initialized. | missing_init.py:9:5:9:23 | Function __init__ | B2.__init__ | missing_init.py:13:1:13:13 | Class B3 | B3 |
|
||||
| missing_init.py:29:5:29:23 | Function __init__ | This initialization method does not call super().__init__, which may cause $@ to be missed during the initialization of $@. | missing_init.py:33:5:33:23 | Function __init__ | UT.__init__ | missing_init.py:42:1:42:21 | Class IUVT | IUVT |
|
||||
| missing_init.py:70:5:70:23 | Function __init__ | This initialization method does not call $@, which may leave $@ partially initialized. | missing_init.py:64:5:64:23 | Function __init__ | AA.__init__ | missing_init.py:67:1:67:13 | Class AB | AB |
|
||||
| missing_init.py:124:9:124:27 | Function __init__ | This initialization method does not call $@, which may leave $@ partially initialized. | missing_init.py:117:5:117:23 | Function __init__ | DA.__init__ | missing_init.py:122:5:122:17 | Class DC | DC |
|
||||
| missing_init.py:134:5:134:23 | Function __init__ | This initialization method does not call $@, which may leave $@ partially initialized. | missing_init.py:117:5:117:23 | Function __init__ | DA.__init__ | missing_init.py:132:1:132:13 | Class DD | DD |
|
||||
| missing_init.py:13:1:13:13 | Class B3 | This class does not call $@ during initialization. ($@ may be missing a call to a base class __init__) | missing_init.py:9:5:9:23 | Function __init__ | B2.__init__ | missing_init.py:14:5:14:23 | Function __init__ | B3.__init__ |
|
||||
| missing_init.py:42:1:42:21 | Class IUVT | This class does not call $@ during initialization. (The class lacks an __init__ method to ensure every base class __init__ is called.) | missing_init.py:33:5:33:23 | Function __init__ | UT.__init__ | file://:0:0:0:0 | (none) | |
|
||||
| missing_init.py:67:1:67:13 | Class AB | This class does not call $@ during initialization. ($@ may be missing a call to a base class __init__) | missing_init.py:64:5:64:23 | Function __init__ | AA.__init__ | missing_init.py:70:5:70:23 | Function __init__ | AB.__init__ |
|
||||
| missing_init.py:122:5:122:17 | Class DC | This class does not call $@ during initialization. ($@ may be missing a call to a base class __init__) | missing_init.py:117:5:117:23 | Function __init__ | DA.__init__ | missing_init.py:124:9:124:27 | Function __init__ | DB.DC.__init__ |
|
||||
| missing_init.py:132:1:132:13 | Class DD | This class does not call $@ during initialization. ($@ may be missing a call to a base class __init__) | missing_init.py:117:5:117:23 | Function __init__ | DA.__init__ | missing_init.py:134:5:134:23 | Function __init__ | DD.__init__ |
|
||||
| missing_init.py:200:1:200:17 | Class H3 | This class does not call $@ during initialization. ($@ may be missing a call to super().__init__) | missing_init.py:197:5:197:23 | Function __init__ | H2.__init__ | missing_init.py:193:5:193:23 | Function __init__ | H1.__init__ |
|
||||
|
||||
@@ -187,3 +187,19 @@ class G3(G1, G2):
|
||||
for cls in self.__class__.__bases__:
|
||||
cls.__init__(self) # We dont track which classes this could refer to, but assume it calls all required init methods and don't alert.
|
||||
|
||||
G3()
|
||||
|
||||
class H1:
|
||||
def __init__(self):
|
||||
print("H1 init")
|
||||
|
||||
class H2:
|
||||
def __init__(self):
|
||||
print("H2 init")
|
||||
|
||||
class H3(H1, H2): # $ Alert # The alert should also mention that H1.__init__ may be missing a call to super().__init__
|
||||
def __init__(self):
|
||||
print("H3 init")
|
||||
super().__init__()
|
||||
|
||||
H3()
|
||||
Reference in New Issue
Block a user