]> granicus.if.org Git - python/commitdiff
bpo-37802: Fix a compiler warning in longobject.c (GH-16517)
authorVictor Stinner <vstinner@redhat.com>
Tue, 1 Oct 2019 11:29:53 +0000 (13:29 +0200)
committerGitHub <noreply@github.com>
Tue, 1 Oct 2019 11:29:53 +0000 (13:29 +0200)
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

Objects/longobject.c

index f2f6f9540892eece80e4169cdf642fbec0c5127c..2b57ea18666eec780bf9fb426bd7940af42c5df0 100644 (file)
@@ -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; \