diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2019-07-28 17:43:54 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-28 17:43:54 -0500 |
commit | 608329acac78b98e9c1044dca23a4f287d639b24 (patch) | |
tree | 3fd259ae783c107b31085d613a67616cf25e2596 | |
parent | edf8a5f70bd946135a07bf8b1eada5feddef4b94 (diff) | |
parent | 621e41d584ee4ec9232576cc637bcc48cf3892be (diff) | |
download | numpy-608329acac78b98e9c1044dca23a4f287d639b24.tar.gz |
Merge pull request #14143 from eric-wieser/fix-14077
BUG: Fix DeprecationWarning in python 3.8 due to implicit conversion to int
-rw-r--r-- | numpy/core/src/multiarray/datetime.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/datetime.c b/numpy/core/src/multiarray/datetime.c index 768eb1e64..60e6bbae2 100644 --- a/numpy/core/src/multiarray/datetime.c +++ b/numpy/core/src/multiarray/datetime.c @@ -2272,7 +2272,10 @@ convert_pydatetime_to_datetimestruct(PyObject *obj, npy_datetimestruct *out, if (tmp == NULL) { return -1; } - seconds_offset = PyInt_AsLong(tmp); + /* Rounding here is no worse than the integer division below. + * Only whole minute offsets are supported by numpy anyway. + */ + seconds_offset = (int)PyFloat_AsDouble(tmp); if (error_converting(seconds_offset)) { Py_DECREF(tmp); return -1; |