summaryrefslogtreecommitdiff
path: root/Cython
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2023-04-06 08:27:08 +0200
committerStefan Behnel <stefan_ml@behnel.de>2023-04-06 08:27:08 +0200
commita5bb829bbc538467d1fe557b6001a4c1c5a88bd9 (patch)
treee4d84ca1d0e61dc4f4f9cb7eae9b6e652a4750d5 /Cython
parent8bf72408e867b873b1c7015aa4959f789fdba79a (diff)
downloadcython-a5bb829bbc538467d1fe557b6001a4c1c5a88bd9.tar.gz
Avoid another potential signedness issue in the new PyLong code.
Diffstat (limited to 'Cython')
-rw-r--r--Cython/Utility/TypeConversion.c2
1 files changed, 1 insertions, 1 deletions
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) \