Issue #19437: Fix datetime_subtract(), handle new_delta() failure

This commit is contained in:
Victor Stinner 2013-11-08 00:50:58 +01:00
parent aa5bbfaa77
commit 70e11acdbd
1 changed files with 3 additions and 0 deletions

View File

@ -4462,6 +4462,9 @@ datetime_subtract(PyObject *left, PyObject *right)
delta_us = DATE_GET_MICROSECOND(left) -
DATE_GET_MICROSECOND(right);
result = new_delta(delta_d, delta_s, delta_us, 1);
if (result == NULL)
return NULL;
if (offdiff != NULL) {
PyObject *temp = result;
result = delta_subtract(result, offdiff);