mirror of https://github.com/pyodide/pyodide.git
113 lines
4.3 KiB
Diff
113 lines
4.3 KiB
Diff
diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h
|
|
index 19bbc7435..ecab1d52a 100644
|
|
--- a/numpy/core/include/numpy/ndarraytypes.h
|
|
+++ b/numpy/core/include/numpy/ndarraytypes.h
|
|
@@ -252,7 +252,8 @@ typedef enum {
|
|
NPY_FR_ps = 11,/* picoseconds */
|
|
NPY_FR_fs = 12,/* femtoseconds */
|
|
NPY_FR_as = 13,/* attoseconds */
|
|
- NPY_FR_GENERIC = 14 /* Generic, unbound units, can convert to anything */
|
|
+ NPY_FR_GENERIC = 14, /* Generic, unbound units, can convert to anything */
|
|
+ NPY_DATETIMEUNIT_NULL = -1
|
|
} NPY_DATETIMEUNIT;
|
|
|
|
/*
|
|
diff --git a/numpy/core/src/multiarray/datetime_strings.c b/numpy/core/src/multiarray/datetime_strings.c
|
|
index b9aeda508..263ef96a1 100644
|
|
--- a/numpy/core/src/multiarray/datetime_strings.c
|
|
+++ b/numpy/core/src/multiarray/datetime_strings.c
|
|
@@ -795,6 +795,8 @@ get_datetime_iso_8601_strlen(int local, NPY_DATETIMEUNIT base)
|
|
case NPY_FR_Y:
|
|
len += 21; /* 64-bit year */
|
|
break;
|
|
+ case NPY_DATETIMEUNIT_NULL:
|
|
+ return 0;
|
|
}
|
|
|
|
if (base >= NPY_FR_h) {
|
|
diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c
|
|
index 486eb43ce..4e3181fc0 100644
|
|
--- a/numpy/core/src/multiarray/item_selection.c
|
|
+++ b/numpy/core/src/multiarray/item_selection.c
|
|
@@ -1113,7 +1113,7 @@ PyArray_Sort(PyArrayObject *op, int axis, NPY_SORTKIND which)
|
|
return -1;
|
|
}
|
|
|
|
- if (which < 0 || which >= NPY_NSORTS) {
|
|
+ if (which >= NPY_NSORTS) {
|
|
PyErr_SetString(PyExc_ValueError, "not a valid sort kind");
|
|
return -1;
|
|
}
|
|
@@ -1221,10 +1221,6 @@ PyArray_Partition(PyArrayObject *op, PyArrayObject * ktharray, int axis,
|
|
return -1;
|
|
}
|
|
|
|
- if (which < 0 || which >= NPY_NSELECTS) {
|
|
- PyErr_SetString(PyExc_ValueError, "not a valid partition kind");
|
|
- return -1;
|
|
- }
|
|
part = get_partition_func(PyArray_TYPE(op), which);
|
|
if (part == NULL) {
|
|
/* Use sorting, slower but equivalent */
|
|
@@ -1263,7 +1259,7 @@ PyArray_ArgSort(PyArrayObject *op, int axis, NPY_SORTKIND which)
|
|
PyArray_ArgSortFunc *argsort;
|
|
PyObject *ret;
|
|
|
|
- if (which < 0 || which >= NPY_NSORTS) {
|
|
+ if (which >= NPY_NSORTS) {
|
|
PyErr_SetString(PyExc_ValueError,
|
|
"not a valid sort kind");
|
|
return NULL;
|
|
@@ -1316,12 +1312,6 @@ PyArray_ArgPartition(PyArrayObject *op, PyArrayObject *ktharray, int axis,
|
|
PyArray_ArgSortFunc *argsort;
|
|
PyObject *ret;
|
|
|
|
- if (which < 0 || which >= NPY_NSELECTS) {
|
|
- PyErr_SetString(PyExc_ValueError,
|
|
- "not a valid partition kind");
|
|
- return NULL;
|
|
- }
|
|
-
|
|
argpart = get_argpartition_func(PyArray_TYPE(op), which);
|
|
if (argpart == NULL) {
|
|
/* Use sorting, slower but equivalent */
|
|
diff --git a/numpy/core/src/private/npy_binsearch.h.src b/numpy/core/src/private/npy_binsearch.h.src
|
|
index 3b2c59487..7d7099d24 100644
|
|
--- a/numpy/core/src/private/npy_binsearch.h.src
|
|
+++ b/numpy/core/src/private/npy_binsearch.h.src
|
|
@@ -106,10 +106,6 @@ get_@arg@binsearch_func(PyArray_Descr *dtype, NPY_SEARCHSIDE side)
|
|
npy_intp max_idx = num_funcs;
|
|
int type = dtype->type_num;
|
|
|
|
- if (side >= NPY_NSEARCHSIDES) {
|
|
- return NULL;
|
|
- }
|
|
-
|
|
/*
|
|
* It seems only fair that a binary search function be searched for
|
|
* using a binary search...
|
|
diff --git a/numpy/core/src/private/npy_partition.h.src b/numpy/core/src/private/npy_partition.h.src
|
|
index 07aecd4f8..8345546cc 100644
|
|
--- a/numpy/core/src/private/npy_partition.h.src
|
|
+++ b/numpy/core/src/private/npy_partition.h.src
|
|
@@ -92,9 +92,6 @@ static NPY_INLINE PyArray_PartitionFunc *
|
|
get_partition_func(int type, NPY_SELECTKIND which)
|
|
{
|
|
npy_intp i;
|
|
- if (which >= NPY_NSELECTS) {
|
|
- return NULL;
|
|
- }
|
|
for (i = 0; i < sizeof(_part_map)/sizeof(_part_map[0]); i++) {
|
|
if (type == _part_map[i].typenum) {
|
|
return _part_map[i].part[which];
|
|
@@ -108,9 +105,6 @@ static NPY_INLINE PyArray_ArgPartitionFunc *
|
|
get_argpartition_func(int type, NPY_SELECTKIND which)
|
|
{
|
|
npy_intp i;
|
|
- if (which >= NPY_NSELECTS) {
|
|
- return NULL;
|
|
- }
|
|
for (i = 0; i < sizeof(_part_map)/sizeof(_part_map[0]); i++) {
|
|
if (type == _part_map[i].typenum) {
|
|
return _part_map[i].argpart[which];
|