From: Daniele Varrazzo Date: Thu, 30 Oct 2025 01:49:08 +0000 (+0000) Subject: perf: use a C var for comparison instead of a Python var X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=75bfd125019739ec3dfbf3c10e9cb8b23ecacab9;p=thirdparty%2Fpsycopg.git perf: use a C var for comparison instead of a Python var --- diff --git a/psycopg_c/psycopg_c/types/numeric.pyx b/psycopg_c/psycopg_c/types/numeric.pyx index 6cd79f021..636e1d20e 100644 --- a/psycopg_c/psycopg_c/types/numeric.pyx +++ b/psycopg_c/psycopg_c/types/numeric.pyx @@ -201,13 +201,13 @@ cdef class IntDumper(CDumper): if overflow: return IntNumeric - if INT32_MIN <= obj <= INT32_MAX: - if INT16_MIN <= obj <= INT16_MAX: + if INT32_MIN <= val <= INT32_MAX: + if INT16_MIN <= val <= INT16_MAX: return Int2 else: return Int4 else: - if INT64_MIN <= obj <= INT64_MAX: + if INT64_MIN <= val <= INT64_MAX: return Int8 else: return IntNumeric @@ -225,13 +225,13 @@ cdef class IntDumper(CDumper): if overflow: return self._int_numeric_dumper(IntNumeric) - if INT32_MIN <= obj <= INT32_MAX: - if INT16_MIN <= obj <= INT16_MAX: + if INT32_MIN <= val <= INT32_MAX: + if INT16_MIN <= val <= INT16_MAX: return self._int2_dumper(Int2) else: return self._int4_dumper(Int4) else: - if INT64_MIN <= obj <= INT64_MAX: + if INT64_MIN <= val <= INT64_MAX: return self._int8_dumper(Int8) else: return self._int_numeric_dumper(IntNumeric)