]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
PostgresQuery const initialisation moved to the class
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 24 Dec 2020 04:00:27 +0000 (05:00 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 24 Dec 2020 04:00:27 +0000 (05:00 +0100)
psycopg3/psycopg3/_queries.py

index cdf4c1883d912036f83fb89ac980d4382e0315dd..5df9237be56516ca0a3aa042c905545d6f6bd91d 100644 (file)
@@ -30,18 +30,18 @@ class PostgresQuery:
     Helper to convert a Python query and parameters into Postgres format.
     """
 
+    _unknown_oid = INVALID_OID
+
     _parts: List[QueryPart]
     _query = b""
-    _unknown_oid = INVALID_OID
+    params: Optional[List[Optional[bytes]]] = None
+    # these are tuples so they can be used as keys e.g. in prepared stmts
+    types: Tuple[int, ...] = ()
+    formats: Optional[List[Format]] = None
+    _order: Optional[List[str]] = None
 
     def __init__(self, transformer: "Transformer"):
         self._tx = transformer
-        self.params: Optional[List[Optional[bytes]]] = None
-        # these are tuples so they can be used as keys e.g. in prepared stmts
-        self.types: Tuple[int, ...] = ()
-        self.formats: Optional[List[Format]] = None
-
-        self._order: Optional[List[str]] = None
         if (
             self._tx.connection
             and self._tx.connection.pgconn.server_version < 100000