NUMPY_API * Get axis from an object (possibly None) -- a converter function, * * See also PyArray_ConvertMultiAxis, which also handles a tuple of axes. */
| 321 | * See also PyArray_ConvertMultiAxis, which also handles a tuple of axes. |
| 322 | */ |
| 323 | NPY_NO_EXPORT int |
| 324 | PyArray_AxisConverter(PyObject *obj, int *axis) |
| 325 | { |
| 326 | if (obj == Py_None) { |
| 327 | *axis = NPY_MAXDIMS; |
| 328 | } |
| 329 | else { |
| 330 | *axis = PyArray_PyIntAsInt_ErrMsg(obj, |
| 331 | "an integer is required for the axis"); |
| 332 | if (error_converting(*axis)) { |
| 333 | return NPY_FAIL; |
| 334 | } |
| 335 | if (*axis == NPY_MAXDIMS){ |
| 336 | /* NumPy 1.23, 2022-05-19 */ |
| 337 | if (DEPRECATE("Using `axis=32` (MAXDIMS) is deprecated. " |
| 338 | "32/MAXDIMS had the same meaning as `axis=None` which " |
| 339 | "should be used instead. " |
| 340 | "(Deprecated NumPy 1.23)") < 0) { |
| 341 | return NPY_FAIL; |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | return NPY_SUCCEED; |
| 346 | } |
| 347 | |
| 348 | /* |
| 349 | * Converts an axis parameter into an ndim-length C-array of |
nothing calls this directly
no test coverage detected