From 70e11acdbd3a206003dd47bbccc111ce1d55b88c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 8 Nov 2013 00:50:58 +0100 Subject: [PATCH] Issue #19437: Fix datetime_subtract(), handle new_delta() failure --- Modules/_datetimemodule.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index a89e0ecae58..1eace71f6ab 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -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);