Skip to content

Commit cf5c7c8

Browse files
Slimming as per Benedikt
1 parent 46d83e3 commit cf5c7c8

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

Modules/_datetimemodule.c

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,22 +3274,17 @@ date_today(PyObject *cls, PyObject *Py_UNUSED(dummy))
32743274
tm.tm_mday,
32753275
(PyTypeObject*)cls);
32763276
}
3277-
else {
3278-
PyObject *time;
3279-
PyObject *result;
3280-
time = time_time();
3281-
if (time == NULL) {
3282-
return NULL;
3283-
}
3284-
3285-
/* Note well: today() is a class method, so this may not call
3286-
* date.fromtimestamp. For example, it may call
3287-
* datetime.fromtimestamp.
3288-
*/
3289-
result = PyObject_CallMethodOneArg(cls, &_Py_ID(fromtimestamp), time);
3290-
Py_DECREF(time);
3291-
return result;
3277+
PyObject *time = time_time();
3278+
if (time == NULL) {
3279+
return NULL;
32923280
}
3281+
3282+
/* Note well: since today() is a class method, it may not call
3283+
* date.fromtimestamp, e.g., it may call datetime.fromtimestamp.
3284+
*/
3285+
PyObject *result = PyObject_CallMethodOneArg(cls, &_Py_ID(fromtimestamp), time);
3286+
Py_DECREF(time);
3287+
return result;
32933288
}
32943289

32953290
/*[clinic input]

0 commit comments

Comments
 (0)