[Python-checkins] bpo-37802: Fix a compiler warning in longobject.c (GH-16517)

Victor Stinner webhook-mailer at python.org
Tue Oct 1 07:29:57 EDT 2019


https://github.com/python/cpython/commit/6314abcc08f5d0f3d3a915dc9455ea223fa65517
commit: 6314abcc08f5d0f3d3a915dc9455ea223fa65517
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019-10-01T13:29:53+02:00
summary:

bpo-37802: Fix a compiler warning in longobject.c (GH-16517)

bpo-37802, bpo-38321: Fix the following warnings:

    longobject.c(420): warning C4244: 'function': conversion from
    'unsigned __int64' to 'sdigit', possible loss of data

    longobject.c(428): warning C4267: 'function': conversion from
    'size_t' to 'sdigit', possible loss of data

files:
M Objects/longobject.c

diff --git a/Objects/longobject.c b/Objects/longobject.c
index f2f6f9540892e..2b57ea18666ee 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -383,7 +383,7 @@ PyLong_FromLong(long ival)
 #define PYLONG_FROM_UINT(INT_TYPE, ival) \
     do { \
         if (IS_SMALL_UINT(ival)) { \
-            return get_small_int((ival)); \
+            return get_small_int((sdigit)(ival)); \
         } \
         /* Count the number of Python digits. */ \
         Py_ssize_t ndigits = 0; \



More information about the Python-checkins mailing list