]> granicus.if.org Git - python/commitdiff
Reuse us_per_second in delta_total_seconds.
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>
Sun, 4 Aug 2013 19:18:58 +0000 (15:18 -0400)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>
Sun, 4 Aug 2013 19:18:58 +0000 (15:18 -0400)
Modules/_datetimemodule.c

index d3929c75639e79dc9fc0e07eadb64d0fa9a12d9b..91d30a02e717847a42c29c07a98c0bcbbb712fda 100644 (file)
@@ -2252,22 +2252,14 @@ delta_total_seconds(PyObject *self)
 {
     PyObject *total_seconds;
     PyObject *total_microseconds;
-    PyObject *one_million;
 
     total_microseconds = delta_to_microseconds((PyDateTime_Delta *)self);
     if (total_microseconds == NULL)
         return NULL;
 
-    one_million = PyLong_FromLong(1000000L);
-    if (one_million == NULL) {
-        Py_DECREF(total_microseconds);
-        return NULL;
-    }
-
-    total_seconds = PyNumber_TrueDivide(total_microseconds, one_million);
+    total_seconds = PyNumber_TrueDivide(total_microseconds, us_per_second);
 
     Py_DECREF(total_microseconds);
-    Py_DECREF(one_million);
     return total_seconds;
 }