summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-07 23:50:58 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-11-07 23:50:58 (GMT)
commit70e11acdbd3a206003dd47bbccc111ce1d55b88c (patch)
tree2cd9ce39cefc2972d1f74921a4a8b3f1ea738832
parentaa5bbfaa77a14634a035233a8879351d320bad6c (diff)
downloadcpython-70e11acdbd3a206003dd47bbccc111ce1d55b88c.zip
cpython-70e11acdbd3a206003dd47bbccc111ce1d55b88c.tar.gz
cpython-70e11acdbd3a206003dd47bbccc111ce1d55b88c.tar.bz2
Issue #19437: Fix datetime_subtract(), handle new_delta() failure
-rw-r--r--Modules/_datetimemodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index a89e0ec..1eace71 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);