MCPcopy
hub / github.com/MagicStack/asyncpg / __del__

Method __del__

asyncpg/connection.py:123–137  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

121 self._source_traceback = None
122
123 def __del__(self):
124 if not self.is_closed() and self._protocol is not None:
125 if self._source_traceback:
126 msg = "unclosed connection {!r}; created at:\n {}".format(
127 self, self._source_traceback)
128 else:
129 msg = (
130 "unclosed connection {!r}; run in asyncio debug "
131 "mode to show the traceback of connection "
132 "origin".format(self)
133 )
134
135 warnings.warn(msg, ResourceWarning)
136 if not self._loop.is_closed():
137 self.terminate()
138
139 async def add_listener(self, channel, callback):
140 """Add a listener for Postgres notifications.

Callers

nothing calls this directly

Calls 2

is_closedMethod · 0.95
terminateMethod · 0.95

Tested by

no test coverage detected