Skip to content

Commit 34315cb

Browse files
committed
Correct types
1 parent ba70518 commit 34315cb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Objects/longobject.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,17 @@ maybe_small_long(PyLongObject *v)
117117

118118
#define PYLONG_FROM_SIGNED(INT_TYPE, ival) \
119119
do { \
120+
unsigned long abs_ival, t; \
120121
if (IS_SMALL_INT(ival)) { \
121122
return get_small_int((sdigit)(ival)); \
122123
} \
123124
if (-(INT_TYPE)PyLong_MASK <= (ival) && (ival) <= (INT_TYPE)PyLong_MASK) { \
124125
return _PyLong_FromMedium((sdigit)(ival)); \
125126
} \
126127
/* Count digits (at least two - smaller cases were handled above). */ \
127-
INT_TYPE abs_ival = (ival) < 0 ? 0U-(INT_TYPE)(ival) : (INT_TYPE)(ival); \
128+
abs_ival = (ival) < 0 ? 0U-(unsigned long)(ival) : (unsigned long)(ival); \
128129
/* Do shift in two steps to avoid possible undefined behavior. */ \
129-
INT_TYPE t = abs_ival >> PyLong_SHIFT >> PyLong_SHIFT; \
130+
t = abs_ival >> PyLong_SHIFT >> PyLong_SHIFT; \
130131
Py_ssize_t ndigits = 2; \
131132
while (t) { \
132133
++ndigits; \

0 commit comments

Comments
 (0)