diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2007-12-04 22:10:37 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2007-12-04 22:10:37 (GMT) |
commit | d1a1d1ed802187cd1a9a8a95ac5d758c7acffee6 (patch) | |
tree | 17489e6ea4df32ba3b3bbda6e4b31155a460f265 /Modules/datetimemodule.c | |
parent | 0fbab7ff8d2efd92e222fcc13c0aff0998c3c158 (diff) | |
download | cpython-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.c | 9 |
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); |