diff options
author | Han <hangenuit@gmail.com> | 2011-08-19 16:58:02 +0200 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2011-08-27 07:26:57 -0600 |
commit | 4838339d30d5d1d4857781a040548c2080713e5b (patch) | |
tree | 7f49c857aae9573dafbf652279dc2b80172434d9 /numpy | |
parent | 630c99a5f0901acbdf336bd0260fb7b83187aea0 (diff) | |
download | numpy-4838339d30d5d1d4857781a040548c2080713e5b.tar.gz |
BUG: fix crash in test_datetime_as_string
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/datetime_strings.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/datetime_strings.c b/numpy/core/src/multiarray/datetime_strings.c index 423528b72..39d2372f2 100644 --- a/numpy/core/src/multiarray/datetime_strings.c +++ b/numpy/core/src/multiarray/datetime_strings.c @@ -1373,7 +1373,7 @@ array_datetime_as_string(PyObject *NPY_UNUSED(self), PyObject *args, } Py_DECREF(strobj); - if (!can_cast_datetime64_units(meta->base, unit, casting)) { + if (unit != -1 && !can_cast_datetime64_units(meta->base, unit, casting)) { PyErr_Format(PyExc_TypeError, "Cannot create a datetime " "string as units '%s' from a NumPy datetime " "with units '%s' according to the rule %s", |