From: Daniele Varrazzo Date: Thu, 8 Dec 2022 14:11:00 +0000 (+0000) Subject: fix: add C Float4 dumper X-Git-Tag: 3.1.5~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60b47a9ce3b37144da28da3eec5627f1b2466b95;p=thirdparty%2Fpsycopg.git fix: add C Float4 dumper It would be used when looked up by oid. At the moment there is only a Python version for it. --- diff --git a/psycopg_c/psycopg_c/types/numeric.pyx b/psycopg_c/psycopg_c/types/numeric.pyx index ba1a0dbe9..893bdc2ad 100644 --- a/psycopg_c/psycopg_c/types/numeric.pyx +++ b/psycopg_c/psycopg_c/types/numeric.pyx @@ -296,11 +296,9 @@ cdef class OidBinaryLoader(CLoader): return PyLong_FromUnsignedLong(endian.be32toh((data)[0])) -@cython.final -cdef class FloatDumper(CDumper): +cdef class _FloatDumper(CDumper): format = PQ_TEXT - oid = oids.FLOAT8_OID cdef Py_ssize_t cdump(self, obj, bytearray rv, Py_ssize_t offset) except -1: cdef double d = PyFloat_AsDouble(obj) @@ -327,6 +325,18 @@ cdef dict _special_float = { } +@cython.final +cdef class FloatDumper(_FloatDumper): + + oid = oids.FLOAT8_OID + + +@cython.final +cdef class Float4Dumper(_FloatDumper): + + oid = oids.FLOAT4_OID + + @cython.final cdef class FloatBinaryDumper(CDumper):