We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a450af6 commit 49d7082Copy full SHA for 49d7082
1 file changed
qcodes/instrument/instrument.py
@@ -69,6 +69,7 @@ def __init__(
69
super().__init__(name=name, metadata=metadata, label=label)
70
71
self.add_parameter("IDN", get_cmd=self.get_idn, vals=Anything())
72
+ weakref.finalize(self, self.__finalize)
73
74
def get_idn(self) -> dict[str, str | None]:
75
"""
@@ -143,7 +144,7 @@ def __repr__(self) -> str:
143
144
"""Simplified repr giving just the class and name."""
145
return f"<{type(self).__name__}: {self.name}>"
146
- def __del__(self) -> None:
147
+ def __finalize(self) -> None:
148
"""Close the instrument and remove its instance record."""
149
try:
150
self.close()
0 commit comments