]> 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:20:53 +0000 (12:20 +0100)
docs/news.rst
psycopg/psycopg/cursor_async.py

index e6eaca639e8790f5a11292ec5e15147a255db25b..fc823cf32f3dca1984945b25372f905b41193565 100644 (file)
@@ -32,6 +32,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)