[New-bugs-announce] [issue39237] Redundant call to round in delta_new

Alex Henrie report at bugs.python.org
Mon Jan 6 15:22:49 EST 2020


New submission from Alex Henrie <alexhenrie24 at gmail.com>:

The delta_new function in _datetimemodule.c currently contains the following code:

    /* Round to nearest whole # of us, and add into x. */
    double whole_us = round(leftover_us);
    int x_is_odd;
    PyObject *temp;

    whole_us = round(leftover_us);

The second call to the round function produces the same result as the first call and can therefore be safely eliminated.

----------
components: Library (Lib)
messages: 359465
nosy: alex.henrie
priority: normal
severity: normal
status: open
title: Redundant call to round in delta_new
type: performance
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39237>
_______________________________________


More information about the New-bugs-announce mailing list