]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
DBAPIConnection can be None for checkin event
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 8 Jan 2024 14:15:17 +0000 (09:15 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 8 Jan 2024 14:15:17 +0000 (09:15 -0500)
Fixed the type signature for the :meth:`.PoolEvents.checkin` event to
indicate that the given :class:`.DBAPIConnection` argument may be ``None``
in the case where the connection has been invalidated.

Change-Id: I4c6f0cf999f2ffb730909e2688eb3b0794ecf2ab

doc/build/changelog/unreleased_20/checkin_conn_none.rst [new file with mode: 0644]
lib/sqlalchemy/pool/events.py

diff --git a/doc/build/changelog/unreleased_20/checkin_conn_none.rst b/doc/build/changelog/unreleased_20/checkin_conn_none.rst
new file mode 100644 (file)
index 0000000..9aeed47
--- /dev/null
@@ -0,0 +1,6 @@
+.. change::
+    :tags: bug, typing
+
+    Fixed the type signature for the :meth:`.PoolEvents.checkin` event to
+    indicate that the given :class:`.DBAPIConnection` argument may be ``None``
+    in the case where the connection has been invalidated.
index 99d180abc99d25eebc455e94e5fa300b98a5cc5d..4b4f4e47851116e139470d024b9899a37c0dcbfa 100644 (file)
@@ -173,7 +173,7 @@ class PoolEvents(event.Events[Pool]):
 
     def checkin(
         self,
-        dbapi_connection: DBAPIConnection,
+        dbapi_connection: Optional[DBAPIConnection],
         connection_record: ConnectionPoolEntry,
     ) -> None:
         """Called when a connection returns to the pool.