MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _safe_close_cursor

Method _safe_close_cursor

lib/sqlalchemy/engine/base.py:2185–2196  ·  view source on GitHub ↗

Close the given cursor, catching exceptions and turning into log warnings.

(self, cursor: DBAPICursor)

Source from the content-addressed store, hash-verified

2183 )
2184
2185 def _safe_close_cursor(self, cursor: DBAPICursor) -> None:
2186 """Close the given cursor, catching exceptions
2187 and turning into log warnings.
2188
2189 """
2190 try:
2191 cursor.close()
2192 except Exception:
2193 # log the error through the connection pool's logger.
2194 self.engine.pool.logger.error(
2195 "Error closing cursor", exc_info=True
2196 )
2197
2198 _reentrant_error = False
2199 _is_disconnect = False

Callers 2

_soft_closeMethod · 0.45

Calls 2

errorMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected