Antoine Pitrou added the comment:
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)
----------
resolution: -> rejected
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23720>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com