summaryrefslogtreecommitdiff
path: root/Cython/Utility/StringTools.c
diff options
context:
space:
mode:
Diffstat (limited to 'Cython/Utility/StringTools.c')
-rw-r--r--Cython/Utility/StringTools.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Cython/Utility/StringTools.c b/Cython/Utility/StringTools.c
index 5d757fd35..553585987 100644
--- a/Cython/Utility/StringTools.c
+++ b/Cython/Utility/StringTools.c
@@ -1061,11 +1061,11 @@ static CYTHON_INLINE int __Pyx_PyByteArray_AppendObject(PyObject* bytearray, PyO
} else
#endif
#if CYTHON_USE_PYLONG_INTERNALS
- if (likely(PyLong_CheckExact(value)) && likely(Py_SIZE(value) == 1 || Py_SIZE(value) == 0)) {
- if (Py_SIZE(value) == 0) {
+ if (likely(PyLong_CheckExact(value)) && likely(__Pyx_PyLong_IsCompact(value))) {
+ if (__Pyx_PyLong_IsZero(value)) {
ival = 0;
} else {
- ival = __Pyx_PyLong_Digits(value)[0];
+ ival = __Pyx_PyLong_CompactValue(value);
if (unlikely(ival > 255)) goto bad_range;
}
} else