MCPcopy Create free account
hub / github.com/numpy/numpy / array_set_string_function

Function array_set_string_function

numpy/core/src/multiarray/multiarraymodule.c:3285–3307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3283}
3284
3285static PyObject *
3286array_set_string_function(PyObject *NPY_UNUSED(self), PyObject *args,
3287 PyObject *kwds)
3288{
3289 PyObject *op = NULL;
3290 int repr = 1;
3291 static char *kwlist[] = {"f", "repr", NULL};
3292
3293 if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oi:set_string_function", kwlist, &op, &repr)) {
3294 return NULL;
3295 }
3296 /* reset the array_repr function to built-in */
3297 if (op == Py_None) {
3298 op = NULL;
3299 }
3300 if (op != NULL && !PyCallable_Check(op)) {
3301 PyErr_SetString(PyExc_TypeError,
3302 "Argument must be callable.");
3303 return NULL;
3304 }
3305 PyArray_SetStringFunction(op, repr);
3306 Py_RETURN_NONE;
3307}
3308
3309static PyObject *
3310array_set_ops_function(PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args),

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected