]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
chore: drop unneeded nonlocal declarations
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 3 Apr 2025 11:07:46 +0000 (12:07 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 3 Apr 2025 16:15:09 +0000 (17:15 +0100)
Flagged by flake8 7.2

tests/pool/test_pool.py
tests/pool/test_pool_async.py
tests/pool/test_pool_common.py
tests/pool/test_pool_common_async.py
tests/pool/test_pool_null.py
tests/pool/test_pool_null_async.py
tests/test_concurrency.py
tests/test_concurrency_async.py
tests/test_errors.py

index cd19b763630037b20058db8d66c93618fb7c1734..05aa44e4cb3142e7d6ce863545140ddfc742c872 100644 (file)
@@ -947,8 +947,6 @@ def test_cancellation_in_queue(dsn):
         def worker(i):
             try:
                 logging.info("worker %s started", i)
-                nonlocal got_conns
-
                 with p.connection() as conn:
                     logging.info("worker %s got conn", i)
                     cur = conn.execute("select 1")
index 580260090bf8bcd4b243fd0ecbce506402cfbe77..f56748d4225a29136e622161c107a90d25413393 100644 (file)
@@ -949,8 +949,6 @@ async def test_cancellation_in_queue(dsn):
         async def worker(i):
             try:
                 logging.info("worker %s started", i)
-                nonlocal got_conns
-
                 async with p.connection() as conn:
                     logging.info("worker %s got conn", i)
                     cur = await conn.execute("select 1")
index 261fb195a1512830e0e52f8fe7352ee651562f93..3c21c098009e5a3c2cd698588d23871768cad2a9 100644 (file)
@@ -655,8 +655,6 @@ def test_cancellation_in_queue(pool_cls, dsn):
         def worker(i):
             try:
                 logging.info("worker %s started", i)
-                nonlocal got_conns
-
                 with p.connection() as conn:
                     logging.info("worker %s got conn", i)
                     cur = conn.execute("select 1")
index 228d19aaebfe378605e964bd563206ce4e671f4e..068064d684e9bb5bd012bffc65dd5834bd768df4 100644 (file)
@@ -665,8 +665,6 @@ async def test_cancellation_in_queue(pool_cls, dsn):
         async def worker(i):
             try:
                 logging.info("worker %s started", i)
-                nonlocal got_conns
-
                 async with p.connection() as conn:
                     logging.info("worker %s got conn", i)
                     cur = await conn.execute("select 1")
index 21a0025badb271056901feed9de0d0168b39c00d..fb2157980e326f11ed373e1a011054cbc9ee0a6c 100644 (file)
@@ -459,8 +459,6 @@ def test_cancellation_in_queue(dsn):
         def worker(i):
             try:
                 logging.info("worker %s started", i)
-                nonlocal got_conns
-
                 with p.connection() as conn:
                     logging.info("worker %s got conn", i)
                     cur = conn.execute("select 1")
index 6346628dcc3c2525a89aa39bcfff587702ce41a8..87e2411d3a2b97b7841367efc0d045d7a7b239a8 100644 (file)
@@ -460,8 +460,6 @@ async def test_cancellation_in_queue(dsn):
         async def worker(i):
             try:
                 logging.info("worker %s started", i)
-                nonlocal got_conns
-
                 async with p.connection() as conn:
                     logging.info("worker %s got conn", i)
                     cur = await conn.execute("select 1")
index 030965580fc244837c806ced6d8c8f989add96e0..488b197c01bba6fa4160b61a785225c4c494678f 100644 (file)
@@ -46,7 +46,6 @@ def test_commit_concurrency(conn):
     stop = False
 
     def committer():
-        nonlocal stop
         while not stop:
             conn.commit()
 
index 63b7b3f81d06cd064767ceaf21db792a570619f0..c69954b13b23b7085a85c550eb04cda4610ba56c 100644 (file)
@@ -25,7 +25,6 @@ async def test_commit_concurrency(aconn):
     stop = False
 
     async def committer():
-        nonlocal stop
         while not stop:
             await aconn.commit()
             await asyncio.sleep(0)  # Allow the other worker to work
index 8dab38fde9252b7396e234d404230e40aac2108f..536cbf3e6b751aec3bf6a427d3be632658236af1 100644 (file)
@@ -54,7 +54,6 @@ def test_diag_right_attr(pgconn, monkeypatch):
     checked: list[pq.DiagnosticField] = []
 
     def check_val(self, v):
-        nonlocal to_check
         assert to_check == v
         checked.append(v)
         return None