gh-135379: fix MSVC warning: conversion from 'stwodigits' to 'digit' (GH-135714)

fix warning C4244: 'initializing': conversion from

'stwodigits' to 'digit', possible loss of data
This commit is contained in:
Chris Eibl 2025-06-20 11:05:33 +02:00 committed by GitHub
parent 2dbada179f
commit 82726600be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -337,7 +337,7 @@ medium_from_stwodigits(stwodigits x)
}
_PyObject_Init((PyObject*)v, &PyLong_Type);
}
digit abs_x = x < 0 ? -x : x;
digit abs_x = x < 0 ? (digit)(-x) : (digit)x;
_PyLong_SetSignAndDigitCount(v, x<0?-1:1, 1);
v->long_value.ob_digit[0] = abs_x;
return PyStackRef_FromPyObjectStealMortal((PyObject *)v);