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

Function arrayflags_writeable_set

numpy/core/src/multiarray/flagsobject.c:316–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316static int
317arrayflags_writeable_set(
318 PyArrayFlagsObject *self, PyObject *obj, void *NPY_UNUSED(ignored))
319{
320 PyObject *res;
321
322 if (obj == NULL) {
323 PyErr_SetString(PyExc_AttributeError,
324 "Cannot delete flags writeable attribute");
325 return -1;
326 }
327 if (self->arr == NULL) {
328 PyErr_SetString(PyExc_ValueError,
329 "Cannot set flags on array scalars.");
330 return -1;
331 }
332 res = PyObject_CallMethod(self->arr, "setflags", "OOO",
333 (PyObject_IsTrue(obj) ? Py_True : Py_False),
334 Py_None, Py_None);
335 if (res == NULL) {
336 return -1;
337 }
338 Py_DECREF(res);
339 return 0;
340}
341
342static int
343arrayflags_warn_on_write_set(

Callers 1

arrayflags_setitemFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected