]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
fix: add missing lock in async executemany with no pipeline
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 19 Aug 2023 17:23:38 +0000 (18:23 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 1 Sep 2023 11:19:46 +0000 (12:19 +0100)
docs/news.rst
psycopg/psycopg/cursor_async.py

index 5b7a07f52af09a94899fddb8512685f6b912cc18..bc770323a77b956a6f91b5baa33431a1a87b28bd 100644 (file)
@@ -14,6 +14,8 @@ Psycopg 3.1.11 (unreleased)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 - Fix integer overflow in C/binary extension with OID > 2^31 (:ticket:`#630`).
+- Fix possible lack of critical section guard in async
+  `~AsyncCursor.executemany()`.
 
 
 Current release
index ab7b07348273c6c17735a2f34bf60e8cb521a521..78acf409ec30dd0b23462b0aecd397df3205d931 100644 (file)
@@ -118,9 +118,10 @@ class AsyncCursor(BaseCursor["AsyncConnection[Any]", Row]):
                             self._executemany_gen_pipeline(query, params_seq, returning)
                         )
             else:
-                await self._conn.wait(
-                    self._executemany_gen_no_pipeline(query, params_seq, returning)
-                )
+                async with self._conn.lock:
+                    await self._conn.wait(
+                        self._executemany_gen_no_pipeline(query, params_seq, returning)
+                    )
         except e._NO_TRACEBACK as ex:
             raise ex.with_traceback(None)