mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Initial commit of Python queries and QL libraries.
This commit is contained in:
committed by
Mark Shannon
parent
90c75cd362
commit
5f58824d1b
32
python/ql/src/Classes/SuperclassDelCalledMultipleTimes2.py
Normal file
32
python/ql/src/Classes/SuperclassDelCalledMultipleTimes2.py
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
#Calling a method multiple times by using explicit calls when a base uses super()
|
||||
class Vehicle(object):
|
||||
|
||||
def __del__(self):
|
||||
recycle(self.base_parts)
|
||||
super(Vehicle, self).__del__()
|
||||
|
||||
class Car(Vehicle):
|
||||
|
||||
def __del__(self):
|
||||
recycle(self.car_parts)
|
||||
super(Car, self).__del__()
|
||||
|
||||
|
||||
class SportsCar(Car, Vehicle):
|
||||
|
||||
# Vehicle.__del__ will get called twice
|
||||
def __del__(self):
|
||||
recycle(self.sports_car_parts)
|
||||
Car.__del__(self)
|
||||
Vehicle.__del__(self)
|
||||
|
||||
|
||||
#Fix SportsCar by using super()
|
||||
class FixedSportsCar(Car, Vehicle):
|
||||
|
||||
def __del__(self):
|
||||
recycle(self.sports_car_parts)
|
||||
super(SportsCar, self).__del__()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user