From a5bb829bbc538467d1fe557b6001a4c1c5a88bd9 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 6 Apr 2023 08:27:08 +0200 Subject: Avoid another potential signedness issue in the new PyLong code. --- Cython/Utility/TypeConversion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Cython') diff --git a/Cython/Utility/TypeConversion.c b/Cython/Utility/TypeConversion.c index 8a672d0a5..6c454d145 100644 --- a/Cython/Utility/TypeConversion.c +++ b/Cython/Utility/TypeConversion.c @@ -137,7 +137,7 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << 3)) // (2 << NON_SIZE_BITS) - #define __Pyx_PyLong_CompactValue(x) ((1 - __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) #define __Pyx_PyLong_DigitCount(x) (((PyLongObject*)x)->long_value.lv_tag >> 3) // (>> NON_SIZE_BITS) #define __Pyx_PyLong_SignedDigitCount(x) \ -- cgit v1.2.1