| 2337 | } |
| 2338 | |
| 2339 | static PyObject * |
| 2340 | array_fromstring(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *keywds) |
| 2341 | { |
| 2342 | char *data; |
| 2343 | Py_ssize_t nin = -1; |
| 2344 | char *sep = NULL; |
| 2345 | Py_ssize_t s; |
| 2346 | static char *kwlist[] = {"string", "dtype", "count", "sep", "like", NULL}; |
| 2347 | PyObject *like = Py_None; |
| 2348 | PyArray_Descr *descr = NULL; |
| 2349 | |
| 2350 | if (!PyArg_ParseTupleAndKeywords(args, keywds, |
| 2351 | "s#|O&" NPY_SSIZE_T_PYFMT "s$O:fromstring", kwlist, |
| 2352 | &data, &s, PyArray_DescrConverter, &descr, &nin, &sep, &like)) { |
| 2353 | Py_XDECREF(descr); |
| 2354 | return NULL; |
| 2355 | } |
| 2356 | if (like != Py_None) { |
| 2357 | PyObject *deferred = array_implement_c_array_function_creation( |
| 2358 | "fromstring", like, args, keywds, NULL, 0, NULL); |
| 2359 | if (deferred != Py_NotImplemented) { |
| 2360 | Py_XDECREF(descr); |
| 2361 | return deferred; |
| 2362 | } |
| 2363 | } |
| 2364 | |
| 2365 | /* binary mode, condition copied from PyArray_FromString */ |
| 2366 | if (sep == NULL || strlen(sep) == 0) { |
| 2367 | /* Numpy 1.14, 2017-10-19 */ |
| 2368 | if (DEPRECATE( |
| 2369 | "The binary mode of fromstring is deprecated, as it behaves " |
| 2370 | "surprisingly on unicode inputs. Use frombuffer instead") < 0) { |
| 2371 | Py_XDECREF(descr); |
| 2372 | return NULL; |
| 2373 | } |
| 2374 | } |
| 2375 | return PyArray_FromString(data, (npy_intp)s, descr, (npy_intp)nin, sep); |
| 2376 | } |
| 2377 | |
| 2378 | |
| 2379 |
nothing calls this directly
no test coverage detected