Skip to content

Commit 68433af

Browse files
Apply suggestions from code review
Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 90f8bf2 commit 68433af

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Python/pytime.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,18 +442,20 @@ checked_divmod(PyObject *a, PyObject *b)
442442
static PyObject *
443443
divide_and_round(PyObject *numerator, PyObject *denominator, _PyTime_round_t round)
444444
{
445-
PyObject *divmod, *result;
446445
if (round == _PyTime_ROUND_UP) {
447446
int isneg = PyObject_RichCompareBool(numerator, _PyLong_GetZero(), Py_LT);
448447
if (isneg < 0) {
449448
return NULL;
450449
}
451450
round = isneg ? _PyTime_ROUND_FLOOR : _PyTime_ROUND_CEILING;
452451
}
452+
453453
if (round == _PyTime_ROUND_FLOOR) {
454454
return PyNumber_FloorDivide(numerator, denominator);
455455
}
456-
else if (round == _PyTime_ROUND_CEILING) {
456+
457+
PyObject *divmod, *result;
458+
if (round == _PyTime_ROUND_CEILING) {
457459
divmod = checked_divmod(numerator, denominator);
458460
if (divmod == NULL) {
459461
return NULL;

0 commit comments

Comments
 (0)