]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
changelog file, docstrings
authorsemen603089 <semen603089@mail.ru>
Sat, 29 Jul 2023 00:14:21 +0000 (03:14 +0300)
committersemen603089 <semen603089@mail.ru>
Sat, 29 Jul 2023 00:14:21 +0000 (03:14 +0300)
doc/build/changelog/unreleased_20/9698.rst [new file with mode: 0644]
lib/sqlalchemy/ext/asyncio/engine.py
lib/sqlalchemy/ext/asyncio/session.py

diff --git a/doc/build/changelog/unreleased_20/9698.rst b/doc/build/changelog/unreleased_20/9698.rst
new file mode 100644 (file)
index 0000000..0cf1658
--- /dev/null
@@ -0,0 +1,9 @@
+.. change::
+    :tags: feature, engine
+    :tickets: 9698
+
+    :func:`.aclose` have been added to :class:`_asyncio.AsyncConnection`
+    and :class:`_asyncio.AsyncSession`.
+    :func:`.aclose` is a synonym for :func:`.close`
+    that is compatible with context managers such as ``@contextlib.aclosing``
+    Patch by Grigoriev Semyon.
\ No newline at end of file
index 08e10c6332c3a7b32774453d336e8c9e99c8de7f..e758e460b07473fa75854f65c408b8e18d56b977 100644 (file)
@@ -477,7 +477,13 @@ class AsyncConnection(
         await greenlet_spawn(self._proxied.close)
 
     async def aclose(self) -> None:
-        """Call the close() method of :class:`_asyncio.AsyncConnection`"""
+        """This method is a synonym for :func:`.close`
+
+        This method is needed for compatibility with context managers,
+        such as ``@contextlib.aclosing``
+
+        .. versionadded:: 2.0.20
+        """
         await self.close()
 
     async def exec_driver_sql(
index 26d0fe644529488f3c7f544fc9d50909f43e6118..fb96010fd75a931aae22df776f8ed2069600ae12 100644 (file)
@@ -974,7 +974,13 @@ class AsyncSession(ReversibleProxy[Session]):
         await greenlet_spawn(self.sync_session.close)
 
     async def aclose(self) -> None:
-        """Call the close() method of :class:`_asyncio.AsyncSession`"""
+        """This method is a synonym for :func:`.close`
+
+        This method is needed for compatibility with context managers,
+        such as ``@contextlib.aclosing``
+
+        .. versionadded:: 2.0.20
+        """
         await self.close()
 
     async def invalidate(self) -> None: