]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Typoeoes
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 26 Mar 2020 13:19:41 +0000 (02:19 +1300)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 26 Mar 2020 13:19:48 +0000 (02:19 +1300)
psycopg3/connection.py
psycopg3/waiting.py
tests/fix_db.py

index cb56ed1ebef5fad1e8502191ac182279251b40bb..86ef56f0bb1c73a2ee9a617598ded38c212e51c0 100644 (file)
@@ -54,7 +54,7 @@ class BaseConnection:
     @classmethod
     def _connect_gen(cls, conninfo):
         """
-        Generator to create a database connection using without blocking.
+        Generator to create a database connection without blocking.
 
         Yield pairs (fileno, `Wait`) whenever an operation would block. The
         generator can be restarted sending the appropriate `Ready` state when
index 67f34bcb7329bcdbc0b42913f4a7ea811c289e62..7a6580f688f7731c650c6c880304deb9bd19be15 100644 (file)
@@ -61,35 +61,35 @@ async def wait_async(gen):
 
     Return what the generator eventually returned.
     """
-    # Use a queue to block and restart after the fd state changes.
+    # Use an event to block and restart after the fd state changes.
     # Not sure this is the best implementation but it's a start.
-    e = Event()
+    ev = Event()
     loop = get_event_loop()
     ready = None
 
     def wakeup(state):
         nonlocal ready
         ready = state
-        e.set()
+        ev.set()
 
     try:
         while 1:
             fd, s = next(gen)
-            e.clear()
+            ev.clear()
             if s is Wait.R:
                 loop.add_reader(fd, wakeup, Ready.R)
-                await e.wait()
+                await ev.wait()
                 loop.remove_reader(fd)
                 gen.send(ready)
             elif s is Wait.W:
                 loop.add_writer(fd, wakeup, Ready.W)
-                await e.wait()
+                await ev.wait()
                 loop.remove_writer(fd)
                 gen.send(ready)
             elif s is Wait.RW:
                 loop.add_reader(fd, wakeup, Ready.R)
                 loop.add_writer(fd, wakeup, Ready.W)
-                await e.wait()
+                await ev.wait()
                 loop.remove_reader(fd)
                 loop.remove_writer(fd)
                 gen.send(ready)
index 140fa9d13a6ae09ad4f133f50d1151a7597fea10..8487fedb88e0cfc128ba30f6355ab3b363cf992e 100644 (file)
@@ -100,7 +100,7 @@ def dsn(request):
 def pgconn(pq, dsn):
     """Return a PGconn connection open to `--test-dsn`."""
     conn = pq.PGconn.connect(dsn.encode("utf8"))
-    if conn.status != 0:
+    if conn.status != pq.ConnStatus.OK:
         pytest.fail(
             f"bad connection: {conn.error_message.decode('utf8', 'replace')}"
         )