Move assertion inside _PyTime_ObjectToTimeval()

Change also _PyTime_FromSeconds() assertion to ensure that the _PyTime_t type
is used.
This commit is contained in:
Victor Stinner 2015-09-02 00:50:43 +02:00
parent 53e137c8dd
commit bbdda21a7a
2 changed files with 14 additions and 7 deletions

View file

@ -4100,7 +4100,6 @@ datetime_from_timestamp(PyObject *cls, TM_FUNC f, PyObject *timestamp,
if (_PyTime_ObjectToTimeval(timestamp,
&timet, &us, _PyTime_ROUND_FLOOR) == -1)
return NULL;
assert(0 <= us && us <= 999999);
return datetime_from_timet_and_us(cls, f, timet, (int)us, tzinfo);
}