summaryrefslogtreecommitdiff
path: root/numpy/lib
diff options
context:
space:
mode:
authorPieter Eendebak <pieter.eendebak@gmail.com>2023-01-23 18:58:02 +0100
committerGitHub <noreply@github.com>2023-01-23 18:58:02 +0100
commit172a1942893b5ce55abccd836fdd9f00235a6767 (patch)
treefb445f677bc077ea59afe6ebfa3d50cbe8c1248f /numpy/lib
parenta701e87ce0b72a84afa839714fc78ded7783326d (diff)
downloadnumpy-172a1942893b5ce55abccd836fdd9f00235a6767.tar.gz
ENH: Convert methods to vectorcall conversions (#23018)
Convert several methods to the vectorcall convention. The conversions give a performance improvement, see #20790 (comment) Some notes: * For vdot the METH_KEYWORDS was removed, as the C vdot method was positional only. * The add_docstring is converted with an additional check. It was parsed as if (!PyArg_ParseTuple(args, "OO!:add_docstring", &obj, &PyUnicode_Type, &str)), but there is no support for the ! in the npy_parse_arguments * CI was complaining about coverage of _get_ndarray_c_version. A test was added, but only to provide coverage * In function_base.py a redundant check in def place was removed Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
Diffstat (limited to 'numpy/lib')
-rw-r--r--numpy/lib/function_base.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index d494aed0f..0ca3c21c1 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -24,7 +24,7 @@ from numpy.core import overrides
from numpy.core.function_base import add_newdoc
from numpy.lib.twodim_base import diag
from numpy.core.multiarray import (
- _insert, add_docstring, bincount, normalize_axis_index, _monotonicity,
+ _place, add_docstring, bincount, normalize_axis_index, _monotonicity,
interp as compiled_interp, interp_complex as compiled_interp_complex
)
from numpy.core.umath import _add_newdoc_ufunc as add_newdoc_ufunc
@@ -1949,11 +1949,7 @@ def place(arr, mask, vals):
[44, 55, 44]])
"""
- if not isinstance(arr, np.ndarray):
- raise TypeError("argument 1 must be numpy.ndarray, "
- "not {name}".format(name=type(arr).__name__))
-
- return _insert(arr, mask, vals)
+ return _place(arr, mask, vals)
def disp(mesg, device=None, linefeed=True):