From: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> Date: Fri, 20 Jun 2025 09:05:33 +0000 (+0200) Subject: gh-135379: fix MSVC warning: conversion from 'stwodigits' to 'digit' (GH-135714) X-Git-Tag: v3.15.0a1~1236 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=82726600be84773c9cca6febdead7a804f4a68bd;p=thirdparty%2FPython%2Fcpython.git 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 --- diff --git a/Objects/longobject.c b/Objects/longobject.c index 59b10355ad9d..557bb6e1dd95 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -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);