MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _safe_close_cursor

Method _safe_close_cursor

lib/sqlalchemy/engine/base.py:2219–2230  ·  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

2217 )
2218
2219 def _safe_close_cursor(self, cursor: DBAPICursor) -> None:
2220 """Close the given cursor, catching exceptions
2221 and turning into log warnings.
2222
2223 """
2224 try:
2225 cursor.close()
2226 except Exception:
2227 # log the error through the connection pool's logger.
2228 self.engine.pool.logger.error(
2229 "Error closing cursor", exc_info=True
2230 )
2231
2232 _reentrant_error = False
2233 _is_disconnect = False

Callers 2

_soft_closeMethod · 0.80

Calls 2

errorMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected