summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2020-06-16 09:29:22 -0500
committerSebastian Berg <sebastian@sipsolutions.net>2020-07-08 18:13:06 -0500
commitbcd332019bb16f8247002b6660f03d782e8b2faf (patch)
tree5ef7397bbbf1f29377722d034c9cfd7d0935f31a
parentb3544a1e1339834af30bc1f6fd9c8f1313b6a96c (diff)
downloadnumpy-bcd332019bb16f8247002b6660f03d782e8b2faf.tar.gz
BUG: Need to set the base field apparently and swap promotion
Swapping promotion should not make a difference, but is a bit closer to what happened before, which should smooth over one failure in the pandas test-suit. The swapping probably only affects the promotion of datetime+float where we have a PR open to disable it in all cases.
-rw-r--r--numpy/core/src/multiarray/array_coercion.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/numpy/core/src/multiarray/array_coercion.c b/numpy/core/src/multiarray/array_coercion.c
index c15f39d95..98061eb3e 100644
--- a/numpy/core/src/multiarray/array_coercion.c
+++ b/numpy/core/src/multiarray/array_coercion.c
@@ -458,7 +458,7 @@ PyArray_Pack(PyArray_Descr *descr, char *item, PyObject *value)
{
PyArrayObject_fields arr_fields = {
.ob_base.ob_refcnt = 1,
- .ob_base.ob_type = NULL,
+ .ob_base.ob_type = &PyArray_Type,
.flags = NPY_ARRAY_WRITEABLE, /* assume array is not behaved. */
};
@@ -684,8 +684,7 @@ handle_promotion(PyArray_Descr **out_descr, PyArray_Descr *descr,
*out_descr = descr;
return 0;
}
- // TODO: Will have to take care of the retry-with-string logic? :(
- PyArray_Descr *new_descr = PyArray_PromoteTypes(*out_descr, descr);
+ PyArray_Descr *new_descr = PyArray_PromoteTypes(descr, *out_descr);
if (new_descr == NULL) {
PyErr_Clear();
*flags |= PROMOTION_FAILED;