https://github.com/python/cpython/commit/82726600be84773c9cca6febdead7a804f4a68bd
commit: 82726600be84773c9cca6febdead7a804f4a68bd
branch: main
author: Chris Eibl <138194463+chris-e...@users.noreply.github.com>
committer: Fidget-Spinner <kenjin4...@gmail.com>
date: 2025-06-20T17:05:33+08:00
summary:

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

files:
M Objects/longobject.c

diff --git a/Objects/longobject.c b/Objects/longobject.c
index 59b10355ad9df8..557bb6e1dd956c 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);

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to