Message238680
Amaury is right. In your case you could keep track of the Vectors in the Device object and invalidate them when the Device is destroyed (using e.g. a WeakSet). Or Vector could delegate its destruction to Device, e.g.:
class Device(object):
destroyed = False
def __del__(self):
self.destroyed = True
def _dealloc_vector(self, v):
if not self.destroyed:
...
class Vector(object):
def __init__(self, device):
self.device = device
def __del__(self):
self.device._dealloc_vector(self) |
|
Date |
User |
Action |
Args |
2015-03-20 14:30:29 | pitrou | set | recipients:
+ pitrou, amaury.forgeotdarc, Vadim Markovtsev, Alexey Kazantsev |
2015-03-20 14:30:29 | pitrou | set | messageid: <1426861829.88.0.301291691525.issue23720@psf.upfronthosting.co.za> |
2015-03-20 14:30:29 | pitrou | link | issue23720 messages |
2015-03-20 14:30:29 | pitrou | create | |
|