summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-06-21 15:21:14 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-06-21 15:21:14 (GMT)
commit75f94c210a9c270dda64135030a29e7791827473 (patch)
treeb725fb91ca15f54e81b8907f69a399da63d7226a /Modules
parentc56b094bab0728e3a157e2b90047efdd2e817153 (diff)
downloadcpython-75f94c210a9c270dda64135030a29e7791827473.zip
cpython-75f94c210a9c270dda64135030a29e7791827473.tar.gz
cpython-75f94c210a9c270dda64135030a29e7791827473.tar.bz2
Issue #9005: Prevent utctimetuple() from producing year 0 or year 10,000.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/datetimemodule.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index ddb5a05..8b3cc06 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -4932,15 +4932,9 @@ datetime_utctimetuple(PyDateTime_DateTime *self)
mm -= offset;
stat = normalize_datetime(&y, &m, &d, &hh, &mm, &ss, &us);
- if (stat < 0) {
- /* At the edges, it's possible we overflowed
- * beyond MINYEAR or MAXYEAR.
- */
- if (PyErr_ExceptionMatches(PyExc_OverflowError))
- PyErr_Clear();
- else
- return NULL;
- }
+ /* OverflowError may be raised in the edge cases. */
+ if (stat < 0)
+ return NULL;
}
return build_struct_time(y, m, d, hh, mm, ss, 0);
}