]> 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 11:07:46 +0000 (12:07 +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 076a976dc137a28bbc71e44c698cdefd5eaaaeb4..873daff4ae0b789136efe5d1cecb62aab3cf0b60 100644 (file)
@@ -948,8 +948,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 aaf780994b805c79b94f17c5f608de0b5b3f9969..939c3f707ecd6743789e5109f980ed5e7a362ac8 100644 (file)
@@ -950,8 +950,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 e18e435285453f25114bec86a5328c5c96d2af3d..9d84e4ae725deb73671f60c6901466b05692df72 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 930ad44dbad5d9d23f85d77391c5e4228796ea7b..1d40c6dd55a41670a4b5d5395d6246651d4b3835 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