(self)
| 35 | """ |
| 36 | |
| 37 | async def close(self) -> None: |
| 38 | if pool := getattr(self, "_pool", None): |
| 39 | # Connection currently checked out from the pool. |
| 40 | # Instead of closing it, return it to the pool. |
| 41 | await pool.putconn(self) |
| 42 | else: |
| 43 | # Connection not part of any pool, or currently into the pool. |
| 44 | # Close the connection for real. |
| 45 | await super().close() |
| 46 | |
| 47 | class PoolConnection(psycopg.Connection): # type: ignore[no-redef] |
| 48 | """ |