8000 BUG: fix crash in test_datetime_as_string · numpy/numpy@7f2f414 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7f2f414

Browse files
87mwiebe
authored andcommitted
BUG: fix crash in test_datetime_as_string
1 parent bacbf75 commit 7f2f414

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

numpy/core/src/multiarray/datetime_strings.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@ array_datetime_as_string(PyObject *NPY_UNUSED(self), PyObject *args,
13731373
}
13741374
Py_DECREF(strobj);
13751375

1376-
if (!can_cast_datetime64_units(meta->base, unit, casting)) {
1376+
if (unit != -1 && !can_cast_datetime64_units(meta->base, unit, casting)) {
13771377
PyErr_Format(PyExc_TypeError, "Cannot create a datetime "
13781378
"string as units '%s' from a NumPy datetime "
13791379
"with units '%s' according to the rule %s",

0 commit comments

Comments
 (0)
0