]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
style: define a symbolic const for null values in array
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 5 Apr 2025 09:41:21 +0000 (10:41 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 5 Apr 2025 09:41:21 +0000 (10:41 +0100)
psycopg/psycopg/types/array.py

index 5c80444fa49481104700e9d39241925afa319384..45becba3e44b860b98efb49be4284b4071baebee 100644 (file)
@@ -33,6 +33,8 @@ _unpack_dim = cast(Callable[[Buffer, int], "tuple[int, int]"], _struct_dim.unpac
 PY_TEXT = PyFormat.TEXT
 PQ_BINARY = pq.Format.BINARY
 
+ARRAY_NULL = b"\xff\xff\xff\xff"
+
 
 class BaseListDumper(RecursiveDumper):
     element_oid = INVALID_OID
@@ -275,7 +277,7 @@ class ListBinaryDumper(BaseListDumper):
                         data.append(item)
                     else:
                         hasnull = 1
-                        data.append(b"\xff\xff\xff\xff")
+                        data.append(ARRAY_NULL)
             else:
                 for item in L:
                     if not isinstance(item, self.cls):