]> granicus.if.org Git - python/commitdiff
_datetimemodule.c: fix the compilation warning "conversion from 'double' to
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 27 Aug 2013 23:53:39 +0000 (01:53 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 27 Aug 2013 23:53:39 +0000 (01:53 +0200)
'long', possible loss of data" in delta_new(), use an explicit cast from double
to long

Modules/_datetimemodule.c

index 18363107091620a4d24ec315d75bbdba5bca27ed..fb78e6d0fe4970439879f0d47e6d181d4d0a2583 100644 (file)
@@ -2160,7 +2160,7 @@ delta_new(PyTypeObject *type, PyObject *args, PyObject *kw)
             whole_us = 2.0 * round((leftover_us + x_is_odd) * 0.5) - x_is_odd;
         }
 
-        temp = PyLong_FromLong(whole_us);
+        temp = PyLong_FromLong((long)whole_us);
 
         if (temp == NULL) {
             Py_DECREF(x);