summaryrefslogtreecommitdiffstats
path: root/Modules/datetimemodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2007-12-04 22:10:37 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2007-12-04 22:10:37 (GMT)
commitd1a1d1ed802187cd1a9a8a95ac5d758c7acffee6 (patch)
tree17489e6ea4df32ba3b3bbda6e4b31155a460f265 /Modules/datetimemodule.c
parent0fbab7ff8d2efd92e222fcc13c0aff0998c3c158 (diff)
downloadcpython-d1a1d1ed802187cd1a9a8a95ac5d758c7acffee6.zip
cpython-d1a1d1ed802187cd1a9a8a95ac5d758c7acffee6.tar.gz
cpython-d1a1d1ed802187cd1a9a8a95ac5d758c7acffee6.tar.bz2
Remove PyInt_CheckExact. Add PyLong_AsLongAndOverflow.
Diffstat (limited to 'Modules/datetimemodule.c')
-rw-r--r--Modules/datetimemodule.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index 6955c78..8eb7e04 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -3827,7 +3827,7 @@ datetime_strptime(PyObject *cls, PyObject *args)
Py_DECREF(module);
if (obj != NULL) {
- int i, good_timetuple = 1;
+ int i, good_timetuple = 1, overflow;
long int ia[6];
if (PySequence_Check(obj) && PySequence_Size(obj) >= 6)
for (i=0; i < 6; i++) {
@@ -3836,8 +3836,11 @@ datetime_strptime(PyObject *cls, PyObject *args)
Py_DECREF(obj);
return NULL;
}
- if (PyInt_CheckExact(p))
- ia[i] = PyLong_AsLong(p);
+ if (PyLong_CheckExact(p)) {
+ ia[i] = PyLong_AsLongAndOverflow(p, &overflow);
+ if (overflow)
+ good_timetuple = 0;
+ }
else
good_timetuple = 0;
Py_DECREF(p);