numpy  2.0.0
src/multiarray/multiarray_tests.c.src File Reference
#include <Python.h>
#include "numpy/arrayobject.h"
#include "mem_overlap.h"
#include "npy_extint128.h"
#include "npy_pycompat.h"

Defines

#define NPY_NO_DEPRECATED_API   NPY_API_VERSION
#define GET_PYBUF_FLAG(FLAG)
#define RETVAL

Typedefs

typedef void(* inplace_map_binop )(PyArrayMapIterObject *, PyArrayIterObject *)

Functions

static PyObject * IsPythonScalar (PyObject *dummy, PyObject *args)
static int copy_ name (PyArrayIterObject *itx, PyArrayNeighborhoodIterObject *niterx, npy_intp *bounds, PyObject **out)
static int copy_object (PyArrayIterObject *itx, PyArrayNeighborhoodIterObject *niterx, npy_intp *bounds, PyObject **out)
static PyObject * test_neighborhood_iterator (PyObject *NPY_UNUSED(self), PyObject *args)
static int copy_double_double (PyArrayNeighborhoodIterObject *itx, PyArrayNeighborhoodIterObject *niterx, npy_intp *bounds, PyObject **out)
static PyObject * test_neighborhood_iterator_oob (PyObject *NPY_UNUSED(self), PyObject *args)
static void test_hook (void *old, void *new, size_t size, void *user_data)
static PyObject * test_pydatamem_seteventhook_start (PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args))
static PyObject * test_pydatamem_seteventhook_end (PyObject *NPY_UNUSED(self), PyObject *NPY_UNUSED(args))
static void npy_float64_inplace_add (PyArrayMapIterObject *mit, PyArrayIterObject *it)
static int map_increment (PyArrayMapIterObject *mit, PyObject *op, inplace_map_binop add_inplace)
static PyObject * inplace_increment (PyObject *dummy, PyObject *args)
static PyObject * incref_elide (PyObject *dummy, PyObject *args)
static PyObject * incref_elide_l (PyObject *dummy, PyObject *args)
static PyObject * int_subclass (PyObject *dummy, PyObject *args)
static PyObject * get_buffer_info (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * array_indexing (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * test_as_c_array (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * test_nditer_too_large (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * array_solve_diophantine (PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *kwds)
static PyObject * array_internal_overlap (PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *kwds)
static PyObject * pylong_from_int128 (npy_extint128_t value)
static int int128_from_pylong (PyObject *obj, npy_extint128_t *result)
static PyObject * extint_safe_binop (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * extint_to_128 (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * extint_to_64 (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * extint_mul_64_64 (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * extint_add_128 (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * extint_sub_128 (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * extint_neg_128 (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * extint_shl_128 (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * extint_shr_128 (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * extint_gt_128 (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * extint_divmod_128_64 (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * extint_floordiv_128_64 (PyObject *NPY_UNUSED(self), PyObject *args)
static PyObject * extint_ceildiv_128_64 (PyObject *NPY_UNUSED(self), PyObject *args)
PyMODINIT_FUNC initmultiarray_tests (void)

Variables

static int malloc_free_counts [2]
static PyDataMem_EventHookFuncold_hook = NULL
static void * old_data
inplace_map_binop addition_funcs []
int type_numbers []
static PyMethodDef Multiarray_TestsMethods []

Define Documentation

#define GET_PYBUF_FLAG (   FLAG)
Value:
buf_flag = PyUnicode_FromString(#FLAG);                         \
    flag_matches = PyObject_RichCompareBool(buf_flag, tmp, Py_EQ);  \
    Py_DECREF(buf_flag);                                            \
    if (flag_matches == 1) {                                        \
        Py_DECREF(tmp);                                             \
        flags |= PyBUF_##FLAG;                                      \
        continue;                                                   \
    }                                                               \
    else if (flag_matches == -1) {                                  \
        Py_DECREF(tmp);                                             \
        return NULL;                                                \
    }
Create python string from a FLAG and or the corresponding PyBuf flag for the use in get_buffer_info.
#define NPY_NO_DEPRECATED_API   NPY_API_VERSION
#define RETVAL

Typedef Documentation


Function Documentation

static PyObject* array_indexing ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
Test C-api level item getting.
static PyObject* array_internal_overlap ( PyObject *  NPY_UNUSEDignored,
PyObject *  args,
PyObject *  kwds 
) [static]
Doesn't happen usually
static PyObject* array_solve_diophantine ( PyObject *  NPY_UNUSEDignored,
PyObject *  args,
PyObject *  kwds 
) [static]
static int copy_double_double ( PyArrayNeighborhoodIterObject itx,
PyArrayNeighborhoodIterObject niterx,
npy_intp bounds,
PyObject **  out 
) [static]
For each point in itx, copy the current neighborhood into an array which is appended at the output list
static int copy_object ( PyArrayIterObject itx,
PyArrayNeighborhoodIterObject niterx,
npy_intp bounds,
PyObject **  out 
) [static]
end repeat*
For each point in itx, copy the current neighborhood into an array which is appended at the output list
static PyObject* extint_add_128 ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
static PyObject* extint_ceildiv_128_64 ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
static PyObject* extint_divmod_128_64 ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
static PyObject* extint_floordiv_128_64 ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]

References extint_to_128().

static PyObject* extint_gt_128 ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
static PyObject* extint_mul_64_64 ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
static PyObject* extint_neg_128 ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
static PyObject* extint_safe_binop ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
static PyObject* extint_shl_128 ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
static PyObject* extint_shr_128 ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
static PyObject* extint_sub_128 ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
static PyObject* extint_to_128 ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]

Referenced by extint_floordiv_128_64().

static PyObject* extint_to_64 ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
static PyObject* get_buffer_info ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
Get information for a buffer through PyBuf_GetBuffer with the corresponding flags or'ed. Note that the python caller has to make sure that or'ing those flags actually makes sense. More information should probably be returned for future tests.
One of the flags must match
static PyObject* incref_elide ( PyObject *  dummy,
PyObject *  args 
) [static]
check no elison for avoided increfs
refcount 1 array but should not be elided
return original copy, should be equal to input
static PyObject* incref_elide_l ( PyObject *  dummy,
PyObject *  args 
) [static]
check no elison for get from list without incref
get item without increasing refcount, item may still be on the python stack but above the inaccessible top
PyMODINIT_FUNC initmultiarray_tests ( void  )
static PyObject* inplace_increment ( PyObject *  dummy,
PyObject *  args 
) [static]
static int int128_from_pylong ( PyObject *  obj,
npy_extint128_t result 
) [static]
False means negative zero

Referenced by extint_safe_binop(), and extint_shl_128().

static PyObject* int_subclass ( PyObject *  dummy,
PyObject *  args 
) [static]
static PyObject* IsPythonScalar ( PyObject *  dummy,
PyObject *  args 
) [static]
test PyArray_IsPythonScalar, before including private py3 compat header
static int map_increment ( PyArrayMapIterObject mit,
PyObject *  op,
inplace_map_binop  add_inplace 
) [static]
static int copy_ name ( PyArrayIterObject itx,
PyArrayNeighborhoodIterObject niterx,
npy_intp bounds,
PyObject **  out 
) [static]
TODO:
  • Handle mode
begin repeat
name = double, int# #type = npy_double, npy_int# #typenum = NPY_DOUBLE, NPY_INT#
For each point in itx, copy the current neighborhood into an array which is appended at the output list

References PyArray_DATA, PyArray_ITER_NEXT, PyArray_NDIM, PyArray_SimpleNew, PyArrayNeighborhoodIter_Next(), and PyArrayNeighborhoodIter_Reset().

static void npy_float64_inplace_add ( PyArrayMapIterObject mit,
PyArrayIterObject it 
) [static]
static PyObject* pylong_from_int128 ( npy_extint128_t  value) [static]

Referenced by extint_safe_binop().

static PyObject* test_as_c_array ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
Test C-api PyArray_AsCArray item getter

<

max 3-dim
static void test_hook ( void *  old,
void *  new,
size_t  size,
void *  user_data 
) [static]

<

malloc counter

<

free counter
static PyObject* test_nditer_too_large ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
Test nditer of too large arrays using remove axis, etc.
Remove an axis (negative, do not remove any)
Test IterNext getting
Test Multi Index removal
Test GotoMultiIndex (just 0 hardcoded)
Test setting iterrange (hardcoded range of 0, 1)
Do nothing
static PyObject* test_neighborhood_iterator ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
Compute boundaries for the neighborhood iterator
Create the neighborhood iterator
static PyObject* test_neighborhood_iterator_oob ( PyObject *  NPY_UNUSEDself,
PyObject *  args 
) [static]
Compute boundaries for the neighborhood iterator
Create the neighborhood iterator
static PyObject* test_pydatamem_seteventhook_end ( PyObject *  NPY_UNUSEDself,
PyObject *  NPY_UNUSEDargs 
) [static]
static PyObject* test_pydatamem_seteventhook_start ( PyObject *  NPY_UNUSEDself,
PyObject *  NPY_UNUSEDargs 
) [static]

Variable Documentation

int malloc_free_counts[2] [static]
PyDataMem_SetHook tests
PyMethodDef Multiarray_TestsMethods[] [static]
void* old_data [static]
int type_numbers[]
Initial value:
 {
NPY_FLOAT64,
-1000}