8000 MAINT: cleanup from finalized concatenate deprecation (#29115) · VascoConceicao/numpy@3dc6fd6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3dc6fd6

Browse files
mattipHenriqueLLuz
authored andcommitted
MAINT: cleanup from finalized concatenate deprecation (numpy#29115)
1 parent ccef821 commit 3dc6fd6

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

numpy/_core/src/multiarray/multiarraymodule.c

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,7 @@ PyArray_ConcatenateArrays(int narrays, PyArrayObject **arrays, int axis,
530530
NPY_NO_EXPORT PyArrayObject *
531531
PyArray_ConcatenateFlattenedArrays(int narrays, PyArrayObject **arrays,
532532
NPY_ORDER order, PyArrayObject *ret,
533-
PyArray_Descr *dtype, NPY_CASTING casting,
534-
npy_bool casting_not_passed)
533+
PyArray_Descr *dtype, NPY_CASTING casting)
535534
{
536535
int iarrays;
537536
npy_intp shape = 0;
@@ -647,12 +646,11 @@ PyArray_ConcatenateFlattenedArrays(int narrays, PyArrayObject **arrays,
647646
* @param ret output array to fill
648647
* @param dtype Forced output array dtype (cannot be combined with ret)
649648
* @param casting Casting mode used
650-
* @param casting_not_passed Deprecation helper
651649
*/
652650
NPY_NO_EXPORT PyObject *
653651
PyArray_ConcatenateInto(PyObject *op,
654652
int axis, PyArrayObject *ret, PyArray_Descr *dtype,
655-
NPY_CASTING casting, npy_bool casting_not_passed)
653+
NPY_CASTING casting)
656654
{
657655
int iarrays, narrays;
658656
PyArrayObject **arrays;
@@ -698,7 +696,7 @@ PyArray_ConcatenateInto(PyObject *op,
698696
if (axis == NPY_RAVEL_AXIS) {
699697
ret = PyArray_ConcatenateFlattenedArrays(
700698
narrays, arrays, NPY_CORDER, ret, dtype,
701-
casting, casting_not_passed);
699+
casting);
702700
}
703701
else {
704702
ret = PyArray_ConcatenateArrays(
@@ -743,7 +741,7 @@ PyArray_Concatenate(PyObject *op, int axis)
743741
casting = NPY_SAME_KIND_CASTING;
744742
}
745743
return PyArray_ConcatenateInto(
746-
op, axis, NULL, NULL, casting, 0);
744+
op, axis, NULL, NULL, casting);
747745
}
748746

749747
static int
@@ -2489,7 +2487,6 @@ array_concatenate(PyObject *NPY_UNUSED(dummy),
24892487
PyObject *out = NULL;
24902488
PyArray_Descr *dtype = NULL;
24912489
NPY_CASTING casting = NPY_SAME_KIND_CASTING;
2492-
PyObject *casting_obj = NULL;
24932490
PyObject *res;
24942491
int axis = 0;
24952492

@@ -2499,22 +2496,10 @@ array_concatenate(PyObject *NPY_UNUSED(dummy),
24992496
"|axis", &PyArray_AxisConverter, &axis,
25002497
"|out", NULL, &out,
25012498
"$dtype", &PyArray_DescrConverter2, &dtype,
2502-
"$casting", NULL, &casting_obj,
2499+
"$casting", &PyArray_CastingConverter, &casting,
25032500
NULL, NULL, NULL) < 0) {
25042501
return NULL;
25052502
}
2506-
int casting_not_passed = 0;
2507-
if (casting_obj == NULL) {
2508-
/*
2509-
* Casting was not passed in, needed for deprecation only.
2510-
* This should be simplified once the deprecation is finished.
2511-
*/
2512-
casting_not_passed = 1;
2513-
}
2514-
else if (!PyArray_CastingConverter(casting_obj, &casting)) {
2515-
Py_XDECREF(dtype);
2516-
return NULL;
2517-
}
25182503
if (out != NULL) {
25192504
if (out == Py_None) {
25202505
out = NULL;
@@ -2526,7 +2511,7 @@ array_concatenate(PyObject *NPY_UNUSED(dummy),
25262511
}
25272512
}
25282513
res = PyArray_ConcatenateInto(a0, axis, (PyArrayObject *)out, dtype,
2529-
casting, casting_not_passed);
2514+
casting);
25302515
Py_XDECREF(dtype);
25312516
return res;
25322517
}

0 commit comments

Comments
 (0)
0