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

Function array__reconstruct

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

Source from the content-addressed store, hash-verified

3245}
3246
3247static PyObject *
3248array__reconstruct(PyObject *NPY_UNUSED(dummy), PyObject *args)
3249{
3250
3251 PyObject *ret;
3252 PyTypeObject *subtype;
3253 PyArray_Dims shape = {NULL, 0};
3254 PyArray_Descr *dtype = NULL;
3255
3256 evil_global_disable_warn_O4O8_flag = 1;
3257
3258 if (!PyArg_ParseTuple(args, "O!O&O&:_reconstruct",
3259 &PyType_Type, &subtype,
3260 PyArray_IntpConverter, &shape,
3261 PyArray_DescrConverter, &dtype)) {
3262 goto fail;
3263 }
3264 if (!PyType_IsSubtype(subtype, &PyArray_Type)) {
3265 PyErr_SetString(PyExc_TypeError,
3266 "_reconstruct: First argument must be a sub-type of ndarray");
3267 goto fail;
3268 }
3269 ret = PyArray_NewFromDescr(subtype, dtype,
3270 (int)shape.len, shape.ptr, NULL, NULL, 0, NULL);
3271 npy_free_cache_dim_obj(shape);
3272
3273 evil_global_disable_warn_O4O8_flag = 0;
3274
3275 return ret;
3276
3277fail:
3278 evil_global_disable_warn_O4O8_flag = 0;
3279
3280 Py_XDECREF(dtype);
3281 npy_free_cache_dim_obj(shape);
3282 return NULL;
3283}
3284
3285static PyObject *
3286array_set_string_function(PyObject *NPY_UNUSED(self), PyObject *args,

Callers

nothing calls this directly

Calls 2

PyArray_NewFromDescrFunction · 0.85
npy_free_cache_dim_objFunction · 0.85

Tested by

no test coverage detected