| 1989 | } |
| 1990 | |
| 1991 | static PyObject * |
| 1992 | array_reduce_ex(PyArrayObject *self, PyObject *args) |
| 1993 | { |
| 1994 | int protocol; |
| 1995 | PyArray_Descr *descr = NULL; |
| 1996 | |
| 1997 | if (!PyArg_ParseTuple(args, "i", &protocol)) { |
| 1998 | return NULL; |
| 1999 | } |
| 2000 | |
| 2001 | descr = PyArray_DESCR(self); |
| 2002 | if ((protocol < 5) || |
| 2003 | (!PyArray_IS_C_CONTIGUOUS((PyArrayObject*)self) && |
| 2004 | !PyArray_IS_F_CONTIGUOUS((PyArrayObject*)self)) || |
| 2005 | PyDataType_FLAGCHK(descr, NPY_ITEM_HASOBJECT) || |
| 2006 | (PyType_IsSubtype(((PyObject*)self)->ob_type, &PyArray_Type) && |
| 2007 | ((PyObject*)self)->ob_type != &PyArray_Type) || |
| 2008 | descr->elsize == 0) { |
| 2009 | /* The PickleBuffer class from version 5 of the pickle protocol |
| 2010 | * can only be used for arrays backed by a contiguous data buffer. |
| 2011 | * For all other cases we fallback to the generic array_reduce |
| 2012 | * method that involves using a temporary bytes allocation. */ |
| 2013 | return array_reduce_ex_regular(self, protocol); |
| 2014 | } |
| 2015 | else { |
| 2016 | return array_reduce_ex_picklebuffer(self, protocol); |
| 2017 | } |
| 2018 | } |
| 2019 | |
| 2020 | static PyObject * |
| 2021 | array_setstate(PyArrayObject *self, PyObject *args) |
nothing calls this directly
no test coverage detected