START: ptest-runner
2025-04-26T09:35
NumPy version 2.2.5
NumPy CPU features:  NEON NEON_FP16 NEON_VFPV4 ASIMD ASIMDHP* ASIMDFHM? SVE?
============================= test session starts ==============================
platform linux -- Python 3.13.2, pytest-8.3.5, pluggy-1.5.0
rootdir: /usr/lib/python3-numpy/ptest
plugins: hypothesis-6.131.0
collected 47990 items

_core/tests/test__exceptions.py ...........                              [  0%]
_core/tests/test_abc.py .....                                            [  0%]
_core/tests/test_api.py ................................................ [  0%]
.......                                                                  [  0%]
_core/tests/test_argparse.py .......                                     [  0%]
_core/tests/test_array_api_info.py ...............                       [  0%]
_core/tests/test_array_coercion.py ..................................... [  0%]
........................x............................................... [  0%]
........................................................................ [  0%]
................................                                         [  0%]
_core/tests/test_array_interface.py E                                    [  0%]
_core/tests/test_arraymethod.py ........................................ [  0%]
                                                                         [  0%]
_core/tests/test_arrayobject.py ..............                           [  0%]
_core/tests/test_arrayprint.py ..x...................................... [  0%]
........................................................................ [  0%]
..                                                                       [  0%]
_core/tests/test_casting_floatingpoint_errors.py ....................... [  1%]
........................................................................ [  1%]
........................................................................ [  1%]
............................................                             [  1%]
_core/tests/test_casting_unittests.py .................................. [  1%]
........................................................................ [  1%]
........................................................................ [  1%]
........................................................................ [  1%]
.....................................................................    [  2%]
_core/tests/test_conversion_utils.py ...........................         [  2%]
_core/tests/test_cpu_dispatcher.py .                                     [  2%]
_core/tests/test_cpu_features.py s......sss.                             [  2%]
_core/tests/test_custom_dtypes.py ...................................... [  2%]
.....                                                                    [  2%]
_core/tests/test_cython.py sssssssssssssssssssss                         [  2%]
_core/tests/test_datetime.py ........................................... [  2%]
........................................................................ [  2%]
................s....................................................... [  2%]
................................................x..........x..x......... [  2%]
.x...................................................................... [  3%]
........................................................................ [  3%]
............................................................             [  3%]
_core/tests/test_defchararray.py ....................................... [  3%]
............................................................             [  3%]
_core/tests/test_deprecations.py ....................................... [  3%]
........................................................................ [  3%]
..                                                                       [  3%]
_core/tests/test_dlpack.py ............................................. [  3%]
.....................................                                    [  3%]
_core/tests/test_dtype.py .............................................. [  3%]
....................................................ssssssssssssssssssss [  4%]
ssssssssssssssss........................................................ [  4%]
........................................................................ [  4%]
........................................................................ [  4%]
........................................................................ [  4%]
........................................................................ [  4%]
........................................................................ [  5%]
........................................................................ [  5%]
........................................................................ [  5%]
........................................................................ [  5%]
........................................................................ [  5%]
........................................................................ [  5%]
........................................................................ [  5%]
........................................................................ [  6%]
........................................................................ [  6%]
......................................                                   [  6%]
_core/tests/test_einsum.py ............................................. [  6%]
.............................                                            [  6%]
_core/tests/test_errstate.py ......                                      [  6%]
_core/tests/test_extint128.py .............                              [  6%]
_core/tests/test_function_base.py ...................................... [  6%]
..                                                                       [  6%]
_core/tests/test_getlimits.py ..................                         [  6%]
_core/tests/test_half.py ....................................            [  6%]
_core/tests/test_hashtable.py .........                                  [  6%]
_core/tests/test_indexerrors.py ........                                 [  6%]
_core/tests/test_indexing.py ........................................... [  6%]
............................................                             [  6%]
_core/tests/test_item_selection.py ..................................... [  6%]
........................................................................ [  7%]
........................................................................ [  7%]
........................................................................ [  7%]
.................................                                        [  7%]
_core/tests/test_limited_api.py s                                        [  7%]
_core/tests/test_longdouble.py ....................ssssssssss....s.      [  7%]
_core/tests/test_machar.py .                                             [  7%]
_core/tests/test_mem_overlap.py .........................                [  7%]
_core/tests/test_mem_policy.py EEEEEsEEEE                                [  7%]
_core/tests/test_memmap.py .....................                         [  7%]
_core/tests/test_multiarray.py ......................................... [  7%]
........................................................................ [  7%]
........................................XX.............................. [  8%]
........................................................................ [  8%]
........................................................................ [  8%]
........................................................................ [  8%]
.......s................................................................ [  8%]
........................................................................ [  8%]
........................................................................ [  8%]
........................................................................ [  9%]
........................................................................ [  9%]
........................................................................ [  9%]
............................................s.s.s.s.s.s.....s.s.....s.s. [  9%]
s.s.......s.s.s.s....................................................... [  9%]
.......................................ss............................... [  9%]
........................................................................ [ 10%]
........................................................................ [ 10%]
........................................................................ [ 10%]
........................................................................ [ 10%]
........................................................................ [ 10%]
........................................................................ [ 10%]
........................................................................ [ 10%]
........................................................................ [ 11%]
........................................................................ [ 11%]
........................................................................ [ 11%]
........................................................................ [ 11%]
........................................................................ [ 11%]
........................................................................ [ 11%]
........................................................................ [ 11%]
........................................................................ [ 12%]
........................................................................ [ 12%]
........................................................................ [ 12%]
........................................................................ [ 12%]
........................................................................ [ 12%]
........................................................................ [ 12%]
........................................................................ [ 13%]
........................................................................ [ 13%]
........................................................................ [ 13%]
........................................................................ [ 13%]
........................................................................ [ 13%]
........................................................................ [ 13%]
........................................................................ [ 13%]
........................................................................ [ 14%]
........................................................................ [ 14%]
........................................................................ [ 14%]
........................................................................ [ 14%]
........................................................................ [ 14%]
........................................................................ [ 14%]
........................................................................ [ 14%]
........................................................................ [ 15%]
........................................................................ [ 15%]
........................................................................ [ 15%]
........................................................................ [ 15%]
........................................................................ [ 15%]
........................................................................ [ 15%]
........................................................................ [ 16%]
........................................................................ [ 16%]
........................................................................ [ 16%]
........................................................................ [ 16%]
........................................................................ [ 16%]
........................................................................ [ 16%]
........................................................................ [ 16%]
........................................................................ [ 17%]
........................................................................ [ 17%]
........................................................................ [ 17%]
........................................................................ [ 17%]
........................................................................ [ 17%]
........................................................................ [ 17%]
........................................................................ [ 17%]
........................................................................ [ 18%]
........................................................................ [ 18%]
........................................................................ [ 18%]
........................................................................ [ 18%]
........................................................................ [ 18%]
........................................................................ [ 18%]
........................................................................ [ 19%]
........................................................................ [ 19%]
........................................................................ [ 19%]
........................................................................ [ 19%]
........................................................................ [ 19%]
........................................................................ [ 19%]
........................................................................ [ 19%]
........................................................................ [ 20%]
........................................................................ [ 20%]
........................................................................ [ 20%]
........................................................................ [ 20%]
........................................................................ [ 20%]
........................................................................ [ 20%]
........................................................................ [ 21%]
........................................................................ [ 21%]
........................................................................ [ 21%]
........................................................................ [ 21%]
........................................................................ [ 21%]
........................................................................ [ 21%]
........................................................................ [ 21%]
........................................................................ [ 22%]
........................................................................ [ 22%]
........................................................................ [ 22%]
........................................................................ [ 22%]
........................................................................ [ 22%]
........................................................................ [ 22%]
........................................................................ [ 22%]
........................................................................ [ 23%]
........................................................................ [ 23%]
........................................................................ [ 23%]
........................................................................ [ 23%]
........................................................................ [ 23%]
........................................................................ [ 23%]
........................................................................ [ 24%]
........................................................................ [ 24%]
........................................................................ [ 24%]
........................................................................ [ 24%]
........................................................................ [ 24%]
........................................................................ [ 24%]
........................................................................ [ 24%]
........................................................................ [ 25%]
........................................................................ [ 25%]
........................................................................ [ 25%]
........................................................................ [ 25%]
........................................................................ [ 25%]
........................................................................ [ 25%]
........................................................................ [ 25%]
........................................................................ [ 26%]
........................................................................ [ 26%]
........................................................................ [ 26%]
........................................................................ [ 26%]
........................................................................ [ 26%]
........................................................................ [ 26%]
........................................................................ [ 27%]
........................................................................ [ 27%]
........................................................................ [ 27%]
........................................................................ [ 27%]
........................................................................ [ 27%]
........................................................................ [ 27%]
........................................................................ [ 27%]
........................................................................ [ 28%]
........................................................................ [ 28%]
........................................................................ [ 28%]
........................................................................ [ 28%]
........................................................................ [ 28%]
........................................................................ [ 28%]
........................................................................ [ 28%]
........................................................................ [ 29%]
........................................................................ [ 29%]
........................................................................ [ 29%]
........................................................................ [ 29%]
........................................................................ [ 29%]
........................................................................ [ 29%]
........................................................................ [ 30%]
........................................................................ [ 30%]
........................................................................ [ 30%]
........................................................................ [ 30%]
........................................................................ [ 30%]
........................................................................ [ 30%]
........................................................................ [ 30%]
........................................................................ [ 31%]
........................................................................ [ 31%]
........................................................................ [ 31%]
........................................................................ [ 31%]
........................................................................ [ 31%]
........................................................................ [ 31%]
........................................................................ [ 31%]
........................................................................ [ 32%]
........................................................................ [ 32%]
........................................................................ [ 32%]
........................................................................ [ 32%]
........................................................................ [ 32%]
........................................................................ [ 32%]
........................................................................ [ 33%]
........................................................................ [ 33%]
........................................................................ [ 33%]
........................................................................ [ 33%]
........................................................................ [ 33%]
........................................................................ [ 33%]
........................................................................ [ 33%]
........................................................................ [ 34%]
........................................................................ [ 34%]
........................................................................ [ 34%]
........................................................................ [ 34%]
........................................................................ [ 34%]
........................................................................ [ 34%]
........................................................................ [ 34%]
........................................................................ [ 35%]
........................................................................ [ 35%]
........................................................................ [ 35%]
........................................................................ [ 35%]
........................................................................ [ 35%]
........................................................................ [ 35%]
........................................................................ [ 36%]
........................................................................ [ 36%]
........................................................................ [ 36%]
........................................................................ [ 36%]
........................................................................ [ 36%]
.                                                                        [ 36%]
_core/tests/test_multithreading.py ..........................            [ 36%]
_core/tests/test_nditer.py ............................................. [ 36%]
........................................................................ [ 36%]
........................................................................ [ 37%]
........................................................................ [ 37%]
........................................................................ [ 37%]
........................................................................ [ 37%]
........................................................................ [ 37%]
........................................................................ [ 37%]
........................................................................ [ 37%]
........................................................................ [ 38%]
........................................................................ [ 38%]
........................................................................ [ 38%]
........................................................................ [ 38%]
..                                                                       [ 38%]
_core/tests/test_nep50_promotions.py ..................s................ [ 38%]
........................................................................ [ 38%]
........................................................................ [ 38%]
........................................................................ [ 39%]
........................................................................ [ 39%]
........................................................................ [ 39%]
................................................                         [ 39%]
_core/tests/test_numeric.py ...............................s...x........ [ 39%]
........................................................................ [ 39%]
........................................................................ [ 39%]
........................................................................ [ 40%]
........................................................................ [ 40%]
........................................................................ [ 40%]
........................................................................ [ 40%]
........................................................................ [ 40%]
........................................................................ [ 40%]
........................................................................ [ 40%]
........................................................................ [ 41%]
........................................................................ [ 41%]
........................................................................ [ 41%]
........................................................................ [ 41%]
........................................................................ [ 41%]
........................................................................ [ 41%]
........................................................................ [ 41%]
........................................................................ [ 42%]
........................................................................ [ 42%]
........................................................................ [ 42%]
........................................................................ [ 42%]
......................X................................................. [ 42%]
....................................................................     [ 42%]
_core/tests/test_numerictypes.py ....................................... [ 42%]
........................................................................ [ 43%]
................................                                         [ 43%]
_core/tests/test_overrides.py .......................................... [ 43%]
........................................................................ [ 43%]
.........................................                                [ 43%]
_core/tests/test_print.py ...................sss                         [ 43%]
_core/tests/test_protocols.py ..                                         [ 43%]
_core/tests/test_records.py .........................................    [ 43%]
_core/tests/test_regression.py ......................................... [ 43%]
........................................................................ [ 43%]
................................................s....................... [ 44%]
........................................................................ [ 44%]
........s............................................................... [ 44%]
........................................................................ [ 44%]
.......................                                                  [ 44%]
_core/tests/test_scalar_ctors.py ....................................... [ 44%]
........................................................................ [ 44%]
.....................................................x..x..x..x......... [ 44%]
..................                                                       [ 44%]
_core/tests/test_scalar_methods.py ..................................... [ 45%]
........................................................................ [ 45%]
..........................                                               [ 45%]
_core/tests/test_scalarbuffer.py ....................................... [ 45%]
.......................................                                  [ 45%]
_core/tests/test_scalarinherit.py ......                                 [ 45%]
_core/tests/test_scalarmath.py ....xs.....................s............. [ 45%]
........................................................................ [ 45%]
........................................................................ [ 45%]
..............................................sssssss................... [ 45%]
........................................................................ [ 46%]
........................................................................ [ 46%]
........................................................................ [ 46%]
........................................................................ [ 46%]
........................................................................ [ 46%]
........................................................................ [ 46%]
........................................................................ [ 46%]
........................................................................ [ 47%]
........................................................................ [ 47%]
........................................................................ [ 47%]
........................................................................ [ 47%]
........................................................................ [ 47%]
........................................................................ [ 47%]
........................................................................ [ 48%]
........................................................................ [ 48%]
........................................................................ [ 48%]
........................................................................ [ 48%]
........................................................................ [ 48%]
.....................................                                    [ 48%]
_core/tests/test_scalarprint.py ........................s                [ 48%]
_core/tests/test_shape_base.py ......................................... [ 48%]
........................................................................ [ 48%]
........................................................................ [ 49%]
..........................                                               [ 49%]
_core/tests/test_simd.py ............................................... [ 49%]
........................................................................ [ 49%]
........................................................................ [ 49%]
........................................................................ [ 49%]
........................................................................ [ 49%]
........................................................................ [ 50%]
........................................................................ [ 50%]
........................................................................ [ 50%]
........................................................................ [ 50%]
........................................................................ [ 50%]
.........                                                                [ 50%]
_core/tests/test_simd_module.py .........................s..........     [ 50%]
_core/tests/test_stringdtype.py .........................ss............. [ 50%]
........................................................................ [ 50%]
........................................................................ [ 51%]
........................................................................ [ 51%]
........................................................................ [ 51%]
........................................................................ [ 51%]
........................................................................ [ 51%]
........................................................................ [ 51%]
........................................................................ [ 52%]
........................................................................ [ 52%]
........................................................................ [ 52%]
........................................................................ [ 52%]
........................................................................ [ 52%]
....ss.................................................................. [ 52%]
........................................................................ [ 52%]
...............................x.....x.................................. [ 53%]
........................................................................ [ 53%]
........................................................................ [ 53%]
........................................................................ [ 53%]
........................................................................ [ 53%]
........................................................................ [ 53%]
........................................................................ [ 53%]
........................................................................ [ 54%]
........................................................................ [ 54%]
........................................................................ [ 54%]
........................................................................ [ 54%]
........................................................................ [ 54%]
........................................................................ [ 54%]
........................................................................ [ 55%]
........................................................................ [ 55%]
........................................................................ [ 55%]
........................................................................ [ 55%]
........................................................................ [ 55%]
........................................................................ [ 55%]
........................................................................ [ 55%]
........................................................................ [ 56%]
........................................................................ [ 56%]
........................................................................ [ 56%]
........................................................................ [ 56%]
............................                                             [ 56%]
_core/tests/test_strings.py ............................................ [ 56%]
........................................................................ [ 56%]
........................ssss............................................ [ 56%]
........................................................................ [ 57%]
........................................................................ [ 57%]
........................................................................ [ 57%]
.....................................................s..s............... [ 57%]
....................s..s................................................ [ 57%]
.........................................s.............................. [ 57%]
........................................................................ [ 58%]
........................................................................ [ 58%]
........................................................................ [ 58%]
........................................................................ [ 58%]
........................................................................ [ 58%]
........................................................................ [ 58%]
........................................................................ [ 58%]
........................................................................ [ 59%]
........................................................................ [ 59%]
........................................................................ [ 59%]
........................................................................ [ 59%]
........................................................................ [ 59%]
........................................................................ [ 59%]
........................................................................ [ 59%]
......................................................                   [ 60%]
_core/tests/test_ufunc.py .............................................. [ 60%]
........................................................................ [ 60%]
...............................................................s........ [ 60%]
........................................................................ [ 60%]
........................................................................ [ 60%]
........................................................................ [ 60%]
........................................................................ [ 61%]
........................................................................ [ 61%]
........................................................................ [ 61%]
........................................................................ [ 61%]
........................................................................ [ 61%]
..............................xxxxxxx..............................      [ 61%]
_core/tests/test_umath.py .............................................. [ 61%]
........................................................................ [ 62%]
........................................................................ [ 62%]
........................................................................ [ 62%]
........................................................................ [ 62%]
........................................................................ [ 62%]
........................................................................ [ 62%]
........................................................................ [ 62%]
........................................................................ [ 63%]
........................................................................ [ 63%]
........................................................................ [ 63%]
........................................................................ [ 63%]
........................................................................ [ 63%]
........................................................................ [ 63%]
........................................................................ [ 64%]
........................................................................ [ 64%]
........................................................................ [ 64%]
........................................................................ [ 64%]
........................................................................ [ 64%]
........................................................................ [ 64%]
........................................................................ [ 64%]
........................................................................ [ 65%]
........................................................................ [ 65%]
........................................................................ [ 65%]
........................................................................ [ 65%]
........................................................................ [ 65%]
........................................................................ [ 65%]
........................................................................ [ 65%]
........................................................................ [ 66%]
........................................................................ [ 66%]
........................................................................ [ 66%]
........................................................................ [ 66%]
........................................................................ [ 66%]
........................................................................ [ 66%]
........................................................................ [ 67%]
........................................................................ [ 67%]
........................................................................ [ 67%]
........................................................................ [ 67%]
........................................................................ [ 67%]
........................................................................ [ 67%]
........................................................................ [ 67%]
........................................................................ [ 68%]
........................................................................ [ 68%]
........................................................................ [ 68%]
........................................................................ [ 68%]
........................................................................ [ 68%]
........................................................................ [ 68%]
........................................................................ [ 68%]
........................................................................ [ 69%]
........................................................................ [ 69%]
........................................................................ [ 69%]
........................................................................ [ 69%]
........................................................................ [ 69%]
........................................................................ [ 69%]
........................................................................ [ 70%]
........................................................................ [ 70%]
........................................................................ [ 70%]
........................................................................ [ 70%]
........................................................................ [ 70%]
....s................................................................... [ 70%]
........................................................................ [ 70%]
...................ss....................ss............................. [ 71%]
........................................................................ [ 71%]
...........................................................sssssssssssss [ 71%]
sssssssssssssss......................................................... [ 71%]
............................................ssssssssssssssssssssssssssss [ 71%]
...............................                                          [ 71%]
_core/tests/test_umath_accuracy.py s.................................... [ 71%]
....s                                                                    [ 71%]
_core/tests/test_umath_complex.py ..s............s...................... [ 71%]
........................................................................ [ 72%]
........................................................................ [ 72%]
........................................................................ [ 72%]
........................................................................ [ 72%]
.......                                                                  [ 72%]
_core/tests/test_unicode.py ............................................ [ 72%]
................................                                         [ 72%]
_pyinstaller/tests/test_pyinstaller.py ss                                [ 72%]
f2py/tests/test_abstract_interface.py ss                                 [ 72%]
f2py/tests/test_array_from_pyobj.py ssssssssssssssssssssssssssssssssssss [ 72%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 72%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 73%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 73%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 73%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 73%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 73%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 73%]
sssssssssssssssssssssssssssssssssssssssss                                [ 73%]
f2py/tests/test_assumed_shape.py ss                                      [ 73%]
f2py/tests/test_block_docstring.py s                                     [ 73%]
f2py/tests/test_callback.py ssssssssssssssssss                           [ 73%]
f2py/tests/test_character.py sssssssssssssssssssssssssssssssssssssssssss [ 74%]
ssssss                                                                   [ 74%]
f2py/tests/test_common.py ss                                             [ 74%]
f2py/tests/test_crackfortran.py s......ssss....ssssssssssssssssss......s [ 74%]
...s.......s                                                             [ 74%]
f2py/tests/test_data.py ssssss                                           [ 74%]
f2py/tests/test_docs.py sss                                              [ 74%]
f2py/tests/test_f2cmap.py s                                              [ 74%]
f2py/tests/test_f2py2e.py ......ssx..............s.........sss.......... [ 74%]
........                                                                 [ 74%]
f2py/tests/test_isoc.py ssss.                                            [ 74%]
f2py/tests/test_kind.py sss                                              [ 74%]
f2py/tests/test_mixed.py ss                                              [ 74%]
f2py/tests/test_modules.py sssss                                         [ 74%]
f2py/tests/test_parameter.py ssssssssssss                                [ 74%]
f2py/tests/test_pyf_src.py .                                             [ 74%]
f2py/tests/test_quoted_character.py s                                    [ 74%]
f2py/tests/test_regression.py ssss.ssssssss                              [ 74%]
f2py/tests/test_return_character.py sssssssssssssss                      [ 74%]
f2py/tests/test_return_complex.py ssssssssssssssss                       [ 74%]
f2py/tests/test_return_integer.py ssssssssssssssssssss                   [ 74%]
f2py/tests/test_return_logical.py ssssssssssssssssss                     [ 74%]
f2py/tests/test_return_real.py ssssssssssssssssssss                      [ 74%]
f2py/tests/test_routines.py ss                                           [ 74%]
f2py/tests/test_semicolon_split.py ss                                    [ 74%]
f2py/tests/test_size.py sss                                              [ 74%]
f2py/tests/test_string.py ssss                                           [ 74%]
f2py/tests/test_symbolic.py ...........                                  [ 74%]
f2py/tests/test_value_attrspec.py s                                      [ 74%]
fft/tests/test_helper.py ........                                        [ 74%]
fft/tests/test_pocketfft.py ............................................ [ 74%]
........................................................................ [ 74%]
................................                                         [ 74%]
lib/tests/test__datasource.py ..........................                 [ 74%]
lib/tests/test__iotools.py ........................                      [ 75%]
lib/tests/test__version.py ........                                      [ 75%]
lib/tests/test_array_utils.py ....                                       [ 75%]
lib/tests/test_arraypad.py ............................................. [ 75%]
..................................X..................................... [ 75%]
........................................................................ [ 75%]
........................................................................ [ 75%]
........................................................................ [ 75%]
........................................................................ [ 75%]
........................................................................ [ 76%]
........................................................................ [ 76%]
................................................................         [ 76%]
lib/tests/test_arraysetops.py .......................................... [ 76%]
............................................                             [ 76%]
lib/tests/test_arrayterator.py .                                         [ 76%]
lib/tests/test_format.py ............s.....................s........     [ 76%]
lib/tests/test_function_base.py ........................................ [ 76%]
........................................................................ [ 76%]
........................................................................ [ 76%]
...x.................................................................... [ 77%]
........................................................................ [ 77%]
........................................................................ [ 77%]
........................................................................ [ 77%]
........................................................................ [ 77%]
........................................................................ [ 77%]
........................................................................ [ 78%]
........................................................................ [ 78%]
........................................................................ [ 78%]
........................................................................ [ 78%]
........................................................................ [ 78%]
........................................................................ [ 78%]
........................................................................ [ 78%]
..........s.s.s.s.s.s.s.s.s.s.s.s...s.s.s.s.s.s.s.s.s.s.s.s...s.s.s.s.s. [ 79%]
s.s.s.s.s.s.s...s.s.s.s.s.s.s.s.s.s.s.s...s.s.s.s.s.s.s.s.s.s.s.s...s.s. [ 79%]
s.s.s.s.s.s.s.s.s.s..................................................... [ 79%]
........                                                                 [ 79%]
lib/tests/test_histograms.py ..........................s................ [ 79%]
.........................                                                [ 79%]
lib/tests/test_index_tricks.py ......................................... [ 79%]
......                                                                   [ 79%]
lib/tests/test_io.py ............s...............................s...... [ 79%]
........................................................................ [ 79%]
........................................................................ [ 80%]
.........................                                                [ 80%]
lib/tests/test_loadtxt.py .............................................. [ 80%]
........................................................................ [ 80%]
........................................................................ [ 80%]
................................x...x...............s.....x............. [ 80%]
.......................................                                  [ 80%]
lib/tests/test_mixins.py ...........                                     [ 80%]
lib/tests/test_nanfunctions.py .....................ss.ss.ss.ss.ss.ss.ss [ 80%]
..........................................ss.ss.ss.ss.ss.ss.ss.......... [ 80%]
........................................................................ [ 81%]
........................................................................ [ 81%]
........................................................................ [ 81%]
........................................................................ [ 81%]
........................................................................ [ 81%]
........................................................................ [ 81%]
........................................................................ [ 82%]
........................................................................ [ 82%]
........................................................................ [ 82%]
........................................................................ [ 82%]
........................................................................ [ 82%]
......................................ss.ss.ss.ss.ss.ss.ss.............. [ 82%]
.............................ss.ss.ss.ss.ss.ss.ss....................... [ 82%]
................ss.ss.ss.ss.ss.ss.ss.................................... [ 83%]
........................................................................ [ 83%]
................ss.ss.ss.ss..............................ss.ss.ss.ss.... [ 83%]
.............                                                            [ 83%]
lib/tests/test_packbits.py ............................................. [ 83%]
........................................................................ [ 83%]
........................................................................ [ 83%]
........................................................................ [ 83%]
...................                                                      [ 83%]
lib/tests/test_polynomial.py .......................................     [ 84%]
lib/tests/test_recfunctions.py ......................................... [ 84%]
..........                                                               [ 84%]
lib/tests/test_regression.py .........................                   [ 84%]
lib/tests/test_shape_base.py ........................................... [ 84%]
..................................                                       [ 84%]
lib/tests/test_stride_tricks.py ..........................               [ 84%]
lib/tests/test_twodim_base.py .....................................      [ 84%]
lib/tests/test_type_check.py ........................................... [ 84%]
........                                                                 [ 84%]
lib/tests/test_ufunclike.py .....                                        [ 84%]
lib/tests/test_utils.py ......                                           [ 84%]
linalg/tests/test_deprecations.py .                                      [ 84%]
linalg/tests/test_linalg.py ............................................ [ 84%]
..................x..................................................... [ 84%]
........................................................................ [ 85%]
........................................................................ [ 85%]
........................................................................ [ 85%]
........................................................................ [ 85%]
.........................sx........                                      [ 85%]
linalg/tests/test_regression.py ...............                          [ 85%]
ma/tests/test_arrayobject.py .....                                       [ 85%]
ma/tests/test_core.py .................................................. [ 85%]
........................................................................ [ 85%]
........................................................................ [ 86%]
........................................................................ [ 86%]
........................................................................ [ 86%]
........................................................................ [ 86%]
........................................................................ [ 86%]
........................................................................ [ 86%]
........................................................................ [ 86%]
........................................................................ [ 87%]
........................................................................ [ 87%]
........................................................................ [ 87%]
........................................................................ [ 87%]
........................................................................ [ 87%]
........................................................................ [ 87%]
........................................................................ [ 87%]
........................................................................ [ 88%]
........................................................................ [ 88%]
........................................................................ [ 88%]
........................................................................ [ 88%]
........................................................................ [ 88%]
........................................................................ [ 88%]
........................................................................ [ 89%]
........................................................................ [ 89%]
........................................................................ [ 89%]
........................................................................ [ 89%]
........................................................................ [ 89%]
........................................................................ [ 89%]
........................................................................ [ 89%]
........................................................................ [ 90%]
........................................................................ [ 90%]
........................................................................ [ 90%]
........................................................................ [ 90%]
........................................................................ [ 90%]
........................................................................ [ 90%]
........................................................................ [ 90%]
........................................................................ [ 91%]
........................................................................ [ 91%]
........................................................................ [ 91%]
........................................................................ [ 91%]
........................................................................ [ 91%]
........................................................................ [ 91%]
........................................................................ [ 92%]
........................................................................ [ 92%]
........................................................................ [ 92%]
........................................................................ [ 92%]
........................................................................ [ 92%]
........................................................................ [ 92%]
........................................................................ [ 92%]
........................................................................ [ 93%]
........................................................................ [ 93%]
........................................................................ [ 93%]
........................................................................ [ 93%]
............................xx.......................................... [ 93%]
........................................................................ [ 93%]
........................................................................ [ 93%]
........................................................................ [ 94%]
..................................................                       [ 94%]
ma/tests/test_deprecations.py .....                                      [ 94%]
ma/tests/test_extras.py ................................................ [ 94%]
......................................................                   [ 94%]
ma/tests/test_mrecords.py ........................                       [ 94%]
ma/tests/test_old_ma.py .........................................        [ 94%]
ma/tests/test_regression.py ..............                               [ 94%]
ma/tests/test_subclassing.py ................                            [ 94%]
matrixlib/tests/test_defmatrix.py ...................................... [ 94%]
.....                                                                    [ 94%]
matrixlib/tests/test_interaction.py .......................              [ 94%]
matrixlib/tests/test_masked_matrix.py ..............                     [ 94%]
matrixlib/tests/test_matrix_linalg.py .................................. [ 94%]
........................................................................ [ 95%]
..............                                                           [ 95%]
matrixlib/tests/test_multiarray.py ..                                    [ 95%]
matrixlib/tests/test_numeric.py ..                                       [ 95%]
matrixlib/tests/test_regression.py ....                                  [ 95%]
polynomial/tests/test_chebyshev.py ..................................... [ 95%]
....                                                                     [ 95%]
polynomial/tests/test_classes.py ....................................... [ 95%]
........................................................................ [ 95%]
........................................................................ [ 95%]
............................................................             [ 95%]
polynomial/tests/test_hermite.py ..................................      [ 95%]
polynomial/tests/test_hermite_e.py ..................................    [ 95%]
polynomial/tests/test_laguerre.py ..................................     [ 95%]
polynomial/tests/test_legendre.py ...................................... [ 95%]
                                                                         [ 95%]
polynomial/tests/test_polynomial.py .................................... [ 96%]
..                                                                       [ 96%]
polynomial/tests/test_polyutils.py ..........                            [ 96%]
polynomial/tests/test_printing.py ...................................... [ 96%]
........................................                                 [ 96%]
polynomial/tests/test_symbol.py ........................................ [ 96%]
............                                                             [ 96%]
random/tests/test_direct.py .................s.................s........ [ 96%]
..........s..................s..................s......                  [ 96%]
random/tests/test_extending.py sss                                       [ 96%]
random/tests/test_generator_mt19937.py ................................. [ 96%]
........................................................................ [ 96%]
........................................................................ [ 96%]
........................................................................ [ 97%]
.......................................................................  [ 97%]
random/tests/test_generator_mt19937_regressions.py ..................    [ 97%]
random/tests/test_random.py ............................................ [ 97%]
........................................................................ [ 97%]
..........................                                               [ 97%]
random/tests/test_randomstate.py ....................................... [ 97%]
........................................................................ [ 97%]
.....................................................................    [ 97%]
random/tests/test_randomstate_regression.py ...................          [ 97%]
random/tests/test_regression.py ...........                              [ 97%]
random/tests/test_seed_sequence.py ..                                    [ 97%]
random/tests/test_smoke.py .s........................................... [ 98%]
........................................................................ [ 98%]
........................................................................ [ 98%]
........................................................................ [ 98%]
...............................ss....................................... [ 98%]
........................................................................ [ 98%]
........................................................................ [ 98%]
.......................................................................  [ 99%]
testing/tests/test_utils.py ............................................ [ 99%]
........................................................................ [ 99%]
................................                                         [ 99%]
tests/test__all__.py .                                                   [ 99%]
tests/test_configtool.py ...                                             [ 99%]
tests/test_ctypeslib.py .......................                          [ 99%]
tests/test_lazyloading.py .                                              [ 99%]
tests/test_matlib.py ........                                            [ 99%]
tests/test_numpy_config.py ....                                          [ 99%]
tests/test_numpy_version.py ...                                          [ 99%]
tests/test_public_api.py ...............                                 [ 99%]
tests/test_reloading.py ...                                              [ 99%]
tests/test_scripts.py Xxx.                                               [ 99%]
tests/test_warnings.py .                                                 [ 99%]
typing/tests/test_isfile.py .                                            [ 99%]
typing/tests/test_runtime.py .....................x...                   [ 99%]
typing/tests/test_typing.py ssssssssssssssssssssssssssssssssssssssssssss [ 99%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 99%]
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss          [100%]

==================================== ERRORS ====================================
________________________ ERROR at setup of test_cstruct ________________________

modname = 'array_interface_testing'
functions = [('new_array_struct', 'METH_VARARGS', '\n\n            long long n_elem = 0;\n            double value = 0.0;\n\n     ...r = %ld"\n                " ptr = %ld\\n", (long)cap, (long)inter, (long)data);\n\n            return cap;\n        ')]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
>           mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)

body       = '\n        #include <Python.h>\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\n        #include <numpy/arr...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0')
functions  = [('new_array_struct', 'METH_VARARGS', '\n\n            long long n_elem = 0;\n            double value = 0.0;\n\n     ...r = %ld"\n                " ptr = %ld\\n", (long)cap, (long)inter, (long)data);\n\n            return cap;\n        ')]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'array_interface_testing'
more_init  = 'import_array();'
prologue   = '\n        #include <Python.h>\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\n        #include <numpy/arr...ct\\ncap = %ld inter = %ld"\n                " ptr = %ld\\n", (long)cap, (long)inter, (long)ptr);\n        }\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #include <Python.h>\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VER...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:111: in compile_extension_module
    return _c_compile(
        builddir   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0/array_interface_testing/source.c')
        dirname    = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0/array_interface_testing')
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        modname    = 'array_interface_testing'
        name       = 'array_interface_testing'
        source_string = '\n    #include <Python.h>\n\n    \n        #include <Python.h>\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VER...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:209: in _c_compile
    build(
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0/array_interface_testing/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0/array_interface_testing/array_interface_testing.cpython-313-aarch64-linux-gnu.so')
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:243: in build
    subprocess.check_call(["meson", "setup", "--vsenv", ".."],
        build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0/array_interface_testing/build')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0/array_interface_testing/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        fid        = <_io.TextIOWrapper name='/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0/array_interface_testing/meson.build' mode='wt' encoding='utf-8'>
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        includes   = ['-I/usr/lib/python3.13/site-packages/numpy/_core/include', '-I/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_dirs  = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0/array_interface_testing/array_interface_testing.cpython-313-aarch64-linux-gnu.so')
        so_name    = 'array_interface_testing.cpython-313-aarch64-linux-gnu.so'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['meson', 'setup', '--vsenv', '..'],)
kwargs = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0/array_interface_testing/build')}
retcode = 1, cmd = ['meson', 'setup', '--vsenv', '..']

    def check_call(*popenargs, **kwargs):
        """Run command with arguments.  Wait for command to complete.  If
        the exit code was zero then return, otherwise raise
        CalledProcessError.  The CalledProcessError object will have the
        return code in the returncode attribute.
    
        The arguments are the same as for the call function.  Example:
    
        check_call(["ls", "-l"])
        """
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           subprocess.CalledProcessError: Command '['meson', 'setup', '--vsenv', '..']' returned non-zero exit status 1.

cmd        = ['meson', 'setup', '--vsenv', '..']
kwargs     = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0/array_interface_testing/build')}
popenargs  = (['meson', 'setup', '--vsenv', '..'],)
retcode    = 1

../../python3.13/subprocess.py:421: CalledProcessError

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0')

    @pytest.fixture
    def get_module(tmp_path):
        """ Some codes to generate data and manage temporary buffers use when
        sharing with numpy via the array interface protocol.
        """
        if sys.platform.startswith('cygwin'):
            pytest.skip('link fails on cygwin')
        if IS_WASM:
            pytest.skip("Can't build module inside Wasm")
        if IS_EDITABLE:
            pytest.skip("Can't build module for editable install")
    
        prologue = '''
            #include <Python.h>
            #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
            #include <numpy/arrayobject.h>
            #include <stdio.h>
            #include <math.h>
    
            NPY_NO_EXPORT
            void delete_array_struct(PyObject *cap) {
    
                /* get the array interface structure */
                PyArrayInterface *inter = (PyArrayInterface*)
                    PyCapsule_GetPointer(cap, NULL);
    
                /* get the buffer by which data was shared */
                double *ptr = (double*)PyCapsule_GetContext(cap);
    
                /* for the purposes of the regression test set the elements
                   to nan */
                for (npy_intp i = 0; i < inter->shape[0]; ++i)
                    ptr[i] = nan("");
    
                /* free the shared buffer */
                free(ptr);
    
                /* free the array interface structure */
                free(inter->shape);
                free(inter);
    
                fprintf(stderr, "delete_array_struct\\ncap = %ld inter = %ld"
                    " ptr = %ld\\n", (long)cap, (long)inter, (long)ptr);
            }
            '''
    
        functions = [
            ("new_array_struct", "METH_VARARGS", """
    
                long long n_elem = 0;
                double value = 0.0;
    
                if (!PyArg_ParseTuple(args, "Ld", &n_elem, &value)) {
                    Py_RETURN_NONE;
                }
    
                /* allocate and initialize the data to share with numpy */
                long long n_bytes = n_elem*sizeof(double);
                double *data = (double*)malloc(n_bytes);
    
                if (!data) {
                    PyErr_Format(PyExc_MemoryError,
                        "Failed to malloc %lld bytes", n_bytes);
    
                    Py_RETURN_NONE;
                }
    
                for (long long i = 0; i < n_elem; ++i) {
                    data[i] = value;
                }
    
                /* calculate the shape and stride */
                int nd = 1;
    
                npy_intp *ss = (npy_intp*)malloc(2*nd*sizeof(npy_intp));
                npy_intp *shape = ss;
                npy_intp *stride = ss + nd;
    
                shape[0] = n_elem;
                stride[0] = sizeof(double);
    
                /* construct the array interface */
                PyArrayInterface *inter = (PyArrayInterface*)
                    malloc(sizeof(PyArrayInterface));
    
                memset(inter, 0, sizeof(PyArrayInterface));
    
                inter->two = 2;
                inter->nd = nd;
                inter->typekind = 'f';
                inter->itemsize = sizeof(double);
                inter->shape = shape;
                inter->strides = stride;
                inter->data = data;
                inter->flags = NPY_ARRAY_WRITEABLE | NPY_ARRAY_NOTSWAPPED |
                               NPY_ARRAY_ALIGNED | NPY_ARRAY_C_CONTIGUOUS;
    
                /* package into a capsule */
                PyObject *cap = PyCapsule_New(inter, NULL, delete_array_struct);
    
                /* save the pointer to the data */
                PyCapsule_SetContext(cap, data);
    
                fprintf(stderr, "new_array_struct\\ncap = %ld inter = %ld"
                    " ptr = %ld\\n", (long)cap, (long)inter, (long)data);
    
                return cap;
            """)
            ]
    
        more_init = "import_array();"
    
        try:
            import array_interface_testing
            return array_interface_testing
        except ImportError:
            pass
    
        # if it does not exist, build and load it
>       return extbuild.build_and_import_extension('array_interface_testing',
                                                   functions,
                                                   prologue=prologue,
                                                   include_dirs=[np.get_include()],
                                                   build_dir=tmp_path,
                                                   more_init=more_init)

functions  = [('new_array_struct', 'METH_VARARGS', '\n\n            long long n_elem = 0;\n            double value = 0.0;\n\n     ...r = %ld"\n                " ptr = %ld\\n", (long)cap, (long)inter, (long)data);\n\n            return cap;\n        ')]
more_init  = 'import_array();'
prologue   = '\n        #include <Python.h>\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\n        #include <numpy/arr...ct\\ncap = %ld inter = %ld"\n                " ptr = %ld\\n", (long)cap, (long)inter, (long)ptr);\n        }\n        '
tmp_path   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0')

../../python3.13/site-packages/numpy/_core/tests/test_array_interface.py:126: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

modname = 'array_interface_testing'
functions = [('new_array_struct', 'METH_VARARGS', '\n\n            long long n_elem = 0;\n            double value = 0.0;\n\n     ...r = %ld"\n                " ptr = %ld\\n", (long)cap, (long)inter, (long)data);\n\n            return cap;\n        ')]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
            mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)
        except Exception as e:
            # shorten the exception chain
>           raise RuntimeError(f"could not compile in {build_dir}:") from e
E           RuntimeError: could not compile in /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0:

body       = '\n        #include <Python.h>\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\n        #include <numpy/arr...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0')
functions  = [('new_array_struct', 'METH_VARARGS', '\n\n            long long n_elem = 0;\n            double value = 0.0;\n\n     ...r = %ld"\n                " ptr = %ld\\n", (long)cap, (long)inter, (long)data);\n\n            return cap;\n        ')]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'array_interface_testing'
more_init  = 'import_array();'
prologue   = '\n        #include <Python.h>\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\n        #include <numpy/arr...ct\\ncap = %ld inter = %ld"\n                " ptr = %ld\\n", (long)cap, (long)inter, (long)ptr);\n        }\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #include <Python.h>\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VER...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:76: RuntimeError
---------------------------- Captured stdout setup -----------------------------
The Meson build system
Version: 1.7.2
Source dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0/array_interface_testing
Build dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0/array_interface_testing/build
Build type: native build
Project name: foo
Project version: undefined

../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
The following exception(s) were encountered:
Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"
Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"

A full log can be found at /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_cstruct0/array_interface_testing/build/meson-logs/meson-log.txt
______________________ ERROR at setup of test_set_policy _______________________

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
>           mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:111: in compile_extension_module
    return _c_compile(
        builddir   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0/mem_policy/source.c')
        dirname    = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0/mem_policy')
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        modname    = 'mem_policy'
        name       = 'mem_policy'
        source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:209: in _c_compile
    build(
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:243: in build
    subprocess.check_call(["meson", "setup", "--vsenv", ".."],
        build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0/mem_policy/build')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        fid        = <_io.TextIOWrapper name='/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0/mem_policy/meson.build' mode='wt' encoding='utf-8'>
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        includes   = ['-I/usr/lib/python3.13/site-packages/numpy/_core/include', '-I/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_dirs  = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
        so_name    = 'mem_policy.cpython-313-aarch64-linux-gnu.so'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['meson', 'setup', '--vsenv', '..'],)
kwargs = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0/mem_policy/build')}
retcode = 1, cmd = ['meson', 'setup', '--vsenv', '..']

    def check_call(*popenargs, **kwargs):
        """Run command with arguments.  Wait for command to complete.  If
        the exit code was zero then return, otherwise raise
        CalledProcessError.  The CalledProcessError object will have the
        return code in the returncode attribute.
    
        The arguments are the same as for the call function.  Example:
    
        check_call(["ls", "-l"])
        """
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           subprocess.CalledProcessError: Command '['meson', 'setup', '--vsenv', '..']' returned non-zero exit status 1.

cmd        = ['meson', 'setup', '--vsenv', '..']
kwargs     = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0/mem_policy/build')}
popenargs  = (['meson', 'setup', '--vsenv', '..'],)
retcode    = 1

../../python3.13/subprocess.py:421: CalledProcessError

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0')

    @pytest.fixture
    def get_module(tmp_path):
        """ Add a memory policy that returns a false pointer 64 bytes into the
        actual allocation, and fill the prefix with some text. Then check at each
        memory manipulation that the prefix exists, to make sure all alloc/realloc/
        free/calloc go via the functions here.
        """
        if sys.platform.startswith('cygwin'):
            pytest.skip('link fails on cygwin')
        if IS_WASM:
            pytest.skip("Can't build module inside Wasm")
        if IS_EDITABLE:
            pytest.skip("Can't build module for editable install")
    
        functions = [
            ("get_default_policy", "METH_NOARGS", """
                 Py_INCREF(PyDataMem_DefaultHandler);
                 return PyDataMem_DefaultHandler;
             """),
            ("set_secret_data_policy", "METH_NOARGS", """
                 PyObject *secret_data =
                     PyCapsule_New(&secret_data_handler, "mem_handler", NULL);
                 if (secret_data == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(secret_data);
                 Py_DECREF(secret_data);
                 return old;
             """),
            ("set_wrong_capsule_name_data_policy", "METH_NOARGS", """
                 PyObject *wrong_name_capsule =
                     PyCapsule_New(&secret_data_handler, "not_mem_handler", NULL);
                 if (wrong_name_capsule == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(wrong_name_capsule);
                 Py_DECREF(wrong_name_capsule);
                 return old;
             """),
            ("set_old_policy", "METH_O", """
                 PyObject *old;
                 if (args != NULL && PyCapsule_CheckExact(args)) {
                     old = PyDataMem_SetHandler(args);
                 }
                 else {
                     old = PyDataMem_SetHandler(NULL);
                 }
                 return old;
             """),
            ("get_array", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                return PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims, NULL,
                                            buf, NPY_ARRAY_WRITEABLE, NULL);
             """),
            ("set_own", "METH_O", """
                if (!PyArray_Check(args)) {
                    PyErr_SetString(PyExc_ValueError,
                                 "need an ndarray");
                    return NULL;
                }
                PyArray_ENABLEFLAGS((PyArrayObject*)args, NPY_ARRAY_OWNDATA);
                // Maybe try this too?
                // PyArray_BASE(PyArrayObject *)args) = NULL;
                Py_RETURN_NONE;
             """),
            ("get_array_with_base", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                PyObject *arr = PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims,
                                                     NULL, buf,
                                                     NPY_ARRAY_WRITEABLE, NULL);
                if (arr == NULL) return NULL;
                PyObject *obj = PyCapsule_New(buf, "buf capsule",
                                              (PyCapsule_Destructor)&warn_on_free);
                if (obj == NULL) {
                    Py_DECREF(arr);
                    return NULL;
                }
                if (PyArray_SetBaseObject((PyArrayObject *)arr, obj) < 0) {
                    Py_DECREF(arr);
                    Py_DECREF(obj);
                    return NULL;
                }
                return arr;
    
             """),
        ]
        prologue = '''
            #define NPY_TARGET_VERSION NPY_1_22_API_VERSION
            #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
            #include <numpy/arrayobject.h>
            /*
             * This struct allows the dynamic configuration of the allocator funcs
             * of the `secret_data_allocator`. It is provided here for
             * demonstration purposes, as a valid `ctx` use-case scenario.
             */
            typedef struct {
                void *(*malloc)(size_t);
                void *(*calloc)(size_t, size_t);
                void *(*realloc)(void *, size_t);
                void (*free)(void *);
            } SecretDataAllocatorFuncs;
    
            NPY_NO_EXPORT void *
            shift_alloc(void *ctx, size_t sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->malloc(sz + 64);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld", (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void *
            shift_zero(void *ctx, size_t sz, size_t cnt) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->calloc(sz + 64, cnt);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld via zero",
                         (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void
            shift_free(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p == NULL) {
                    return ;
                }
                char *real = (char *)p - 64;
                if (strncmp(real, "originally allocated", 20) != 0) {
                    fprintf(stdout, "uh-oh, unmatched shift_free, "
                            "no appropriate prefix\\n");
                    /* Make C runtime crash by calling free on the wrong address */
                    funcs->free((char *)p + 10);
                    /* funcs->free(real); */
                }
                else {
                    npy_uintp i = (npy_uintp)atoi(real +20);
                    if (i != sz) {
                        fprintf(stderr, "uh-oh, unmatched shift_free"
                                "(ptr, %ld) but allocated %ld\\n", sz, i);
                        /* This happens in some places, only print */
                        funcs->free(real);
                    }
                    else {
                        funcs->free(real);
                    }
                }
            }
            NPY_NO_EXPORT void *
            shift_realloc(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p != NULL) {
                    char *real = (char *)p - 64;
                    if (strncmp(real, "originally allocated", 20) != 0) {
                        fprintf(stdout, "uh-oh, unmatched shift_realloc\\n");
                        return realloc(p, sz);
                    }
                    return (void *)((char *)funcs->realloc(real, sz + 64) + 64);
                }
                else {
                    char *real = (char *)funcs->realloc(p, sz + 64);
                    if (real == NULL) {
                        return NULL;
                    }
                    snprintf(real, 64, "originally allocated "
                             "%ld  via realloc", (unsigned long)sz);
                    return (void *)(real + 64);
                }
            }
            /* As an example, we use the standard {m|c|re}alloc/free funcs. */
            static SecretDataAllocatorFuncs secret_data_handler_ctx = {
                malloc,
                calloc,
                realloc,
                free
            };
            static PyDataMem_Handler secret_data_handler = {
                "secret_data_allocator",
                1,
                {
                    &secret_data_handler_ctx, /* ctx */
                    shift_alloc,              /* malloc */
                    shift_zero,               /* calloc */
                    shift_realloc,            /* realloc */
                    shift_free                /* free */
                }
            };
            void warn_on_free(void *capsule) {
                PyErr_WarnEx(PyExc_UserWarning, "in warn_on_free", 1);
                void * obj = PyCapsule_GetPointer(capsule,
                                                  PyCapsule_GetName(capsule));
                free(obj);
            };
            '''
        more_init = "import_array();"
        try:
            import mem_policy
            return mem_policy
        except ImportError:
            pass
        # if it does not exist, build and load it
>       return extbuild.build_and_import_extension('mem_policy',
                                                   functions,
                                                   prologue=prologue,
                                                   include_dirs=[np.get_include()],
                                                   build_dir=tmp_path,
                                                   more_init=more_init)

functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
tmp_path   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0')

../../python3.13/site-packages/numpy/_core/tests/test_mem_policy.py:223: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
            mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)
        except Exception as e:
            # shorten the exception chain
>           raise RuntimeError(f"could not compile in {build_dir}:") from e
E           RuntimeError: could not compile in /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0:

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:76: RuntimeError
---------------------------- Captured stdout setup -----------------------------
The Meson build system
Version: 1.7.2
Source dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0/mem_policy
Build dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0/mem_policy/build
Build type: native build
Project name: foo
Project version: undefined

../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
The following exception(s) were encountered:
Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"
Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"

A full log can be found at /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_set_policy0/mem_policy/build/meson-logs/meson-log.txt
_______________ ERROR at setup of test_default_policy_singleton ________________

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
>           mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:111: in compile_extension_module
    return _c_compile(
        builddir   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0/mem_policy/source.c')
        dirname    = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0/mem_policy')
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        modname    = 'mem_policy'
        name       = 'mem_policy'
        source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:209: in _c_compile
    build(
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:243: in build
    subprocess.check_call(["meson", "setup", "--vsenv", ".."],
        build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0/mem_policy/build')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        fid        = <_io.TextIOWrapper name='/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0/mem_policy/meson.build' mode='wt' encoding='utf-8'>
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        includes   = ['-I/usr/lib/python3.13/site-packages/numpy/_core/include', '-I/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_dirs  = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
        so_name    = 'mem_policy.cpython-313-aarch64-linux-gnu.so'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['meson', 'setup', '--vsenv', '..'],)
kwargs = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0/mem_policy/build')}
retcode = 1, cmd = ['meson', 'setup', '--vsenv', '..']

    def check_call(*popenargs, **kwargs):
        """Run command with arguments.  Wait for command to complete.  If
        the exit code was zero then return, otherwise raise
        CalledProcessError.  The CalledProcessError object will have the
        return code in the returncode attribute.
    
        The arguments are the same as for the call function.  Example:
    
        check_call(["ls", "-l"])
        """
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           subprocess.CalledProcessError: Command '['meson', 'setup', '--vsenv', '..']' returned non-zero exit status 1.

cmd        = ['meson', 'setup', '--vsenv', '..']
kwargs     = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0/mem_policy/build')}
popenargs  = (['meson', 'setup', '--vsenv', '..'],)
retcode    = 1

../../python3.13/subprocess.py:421: CalledProcessError

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0')

    @pytest.fixture
    def get_module(tmp_path):
        """ Add a memory policy that returns a false pointer 64 bytes into the
        actual allocation, and fill the prefix with some text. Then check at each
        memory manipulation that the prefix exists, to make sure all alloc/realloc/
        free/calloc go via the functions here.
        """
        if sys.platform.startswith('cygwin'):
            pytest.skip('link fails on cygwin')
        if IS_WASM:
            pytest.skip("Can't build module inside Wasm")
        if IS_EDITABLE:
            pytest.skip("Can't build module for editable install")
    
        functions = [
            ("get_default_policy", "METH_NOARGS", """
                 Py_INCREF(PyDataMem_DefaultHandler);
                 return PyDataMem_DefaultHandler;
             """),
            ("set_secret_data_policy", "METH_NOARGS", """
                 PyObject *secret_data =
                     PyCapsule_New(&secret_data_handler, "mem_handler", NULL);
                 if (secret_data == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(secret_data);
                 Py_DECREF(secret_data);
                 return old;
             """),
            ("set_wrong_capsule_name_data_policy", "METH_NOARGS", """
                 PyObject *wrong_name_capsule =
                     PyCapsule_New(&secret_data_handler, "not_mem_handler", NULL);
                 if (wrong_name_capsule == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(wrong_name_capsule);
                 Py_DECREF(wrong_name_capsule);
                 return old;
             """),
            ("set_old_policy", "METH_O", """
                 PyObject *old;
                 if (args != NULL && PyCapsule_CheckExact(args)) {
                     old = PyDataMem_SetHandler(args);
                 }
                 else {
                     old = PyDataMem_SetHandler(NULL);
                 }
                 return old;
             """),
            ("get_array", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                return PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims, NULL,
                                            buf, NPY_ARRAY_WRITEABLE, NULL);
             """),
            ("set_own", "METH_O", """
                if (!PyArray_Check(args)) {
                    PyErr_SetString(PyExc_ValueError,
                                 "need an ndarray");
                    return NULL;
                }
                PyArray_ENABLEFLAGS((PyArrayObject*)args, NPY_ARRAY_OWNDATA);
                // Maybe try this too?
                // PyArray_BASE(PyArrayObject *)args) = NULL;
                Py_RETURN_NONE;
             """),
            ("get_array_with_base", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                PyObject *arr = PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims,
                                                     NULL, buf,
                                                     NPY_ARRAY_WRITEABLE, NULL);
                if (arr == NULL) return NULL;
                PyObject *obj = PyCapsule_New(buf, "buf capsule",
                                              (PyCapsule_Destructor)&warn_on_free);
                if (obj == NULL) {
                    Py_DECREF(arr);
                    return NULL;
                }
                if (PyArray_SetBaseObject((PyArrayObject *)arr, obj) < 0) {
                    Py_DECREF(arr);
                    Py_DECREF(obj);
                    return NULL;
                }
                return arr;
    
             """),
        ]
        prologue = '''
            #define NPY_TARGET_VERSION NPY_1_22_API_VERSION
            #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
            #include <numpy/arrayobject.h>
            /*
             * This struct allows the dynamic configuration of the allocator funcs
             * of the `secret_data_allocator`. It is provided here for
             * demonstration purposes, as a valid `ctx` use-case scenario.
             */
            typedef struct {
                void *(*malloc)(size_t);
                void *(*calloc)(size_t, size_t);
                void *(*realloc)(void *, size_t);
                void (*free)(void *);
            } SecretDataAllocatorFuncs;
    
            NPY_NO_EXPORT void *
            shift_alloc(void *ctx, size_t sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->malloc(sz + 64);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld", (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void *
            shift_zero(void *ctx, size_t sz, size_t cnt) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->calloc(sz + 64, cnt);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld via zero",
                         (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void
            shift_free(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p == NULL) {
                    return ;
                }
                char *real = (char *)p - 64;
                if (strncmp(real, "originally allocated", 20) != 0) {
                    fprintf(stdout, "uh-oh, unmatched shift_free, "
                            "no appropriate prefix\\n");
                    /* Make C runtime crash by calling free on the wrong address */
                    funcs->free((char *)p + 10);
                    /* funcs->free(real); */
                }
                else {
                    npy_uintp i = (npy_uintp)atoi(real +20);
                    if (i != sz) {
                        fprintf(stderr, "uh-oh, unmatched shift_free"
                                "(ptr, %ld) but allocated %ld\\n", sz, i);
                        /* This happens in some places, only print */
                        funcs->free(real);
                    }
                    else {
                        funcs->free(real);
                    }
                }
            }
            NPY_NO_EXPORT void *
            shift_realloc(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p != NULL) {
                    char *real = (char *)p - 64;
                    if (strncmp(real, "originally allocated", 20) != 0) {
                        fprintf(stdout, "uh-oh, unmatched shift_realloc\\n");
                        return realloc(p, sz);
                    }
                    return (void *)((char *)funcs->realloc(real, sz + 64) + 64);
                }
                else {
                    char *real = (char *)funcs->realloc(p, sz + 64);
                    if (real == NULL) {
                        return NULL;
                    }
                    snprintf(real, 64, "originally allocated "
                             "%ld  via realloc", (unsigned long)sz);
                    return (void *)(real + 64);
                }
            }
            /* As an example, we use the standard {m|c|re}alloc/free funcs. */
            static SecretDataAllocatorFuncs secret_data_handler_ctx = {
                malloc,
                calloc,
                realloc,
                free
            };
            static PyDataMem_Handler secret_data_handler = {
                "secret_data_allocator",
                1,
                {
                    &secret_data_handler_ctx, /* ctx */
                    shift_alloc,              /* malloc */
                    shift_zero,               /* calloc */
                    shift_realloc,            /* realloc */
                    shift_free                /* free */
                }
            };
            void warn_on_free(void *capsule) {
                PyErr_WarnEx(PyExc_UserWarning, "in warn_on_free", 1);
                void * obj = PyCapsule_GetPointer(capsule,
                                                  PyCapsule_GetName(capsule));
                free(obj);
            };
            '''
        more_init = "import_array();"
        try:
            import mem_policy
            return mem_policy
        except ImportError:
            pass
        # if it does not exist, build and load it
>       return extbuild.build_and_import_extension('mem_policy',
                                                   functions,
                                                   prologue=prologue,
                                                   include_dirs=[np.get_include()],
                                                   build_dir=tmp_path,
                                                   more_init=more_init)

functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
tmp_path   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0')

../../python3.13/site-packages/numpy/_core/tests/test_mem_policy.py:223: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
            mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)
        except Exception as e:
            # shorten the exception chain
>           raise RuntimeError(f"could not compile in {build_dir}:") from e
E           RuntimeError: could not compile in /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0:

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:76: RuntimeError
---------------------------- Captured stdout setup -----------------------------
The Meson build system
Version: 1.7.2
Source dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0/mem_policy
Build dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0/mem_policy/build
Build type: native build
Project name: foo
Project version: undefined

../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
The following exception(s) were encountered:
Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"
Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"

A full log can be found at /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_default_policy_singleton0/mem_policy/build/meson-logs/meson-log.txt
__________________ ERROR at setup of test_policy_propagation ___________________

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
>           mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:111: in compile_extension_module
    return _c_compile(
        builddir   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0/mem_policy/source.c')
        dirname    = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0/mem_policy')
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        modname    = 'mem_policy'
        name       = 'mem_policy'
        source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:209: in _c_compile
    build(
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:243: in build
    subprocess.check_call(["meson", "setup", "--vsenv", ".."],
        build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0/mem_policy/build')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        fid        = <_io.TextIOWrapper name='/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0/mem_policy/meson.build' mode='wt' encoding='utf-8'>
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        includes   = ['-I/usr/lib/python3.13/site-packages/numpy/_core/include', '-I/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_dirs  = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
        so_name    = 'mem_policy.cpython-313-aarch64-linux-gnu.so'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['meson', 'setup', '--vsenv', '..'],)
kwargs = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0/mem_policy/build')}
retcode = 1, cmd = ['meson', 'setup', '--vsenv', '..']

    def check_call(*popenargs, **kwargs):
        """Run command with arguments.  Wait for command to complete.  If
        the exit code was zero then return, otherwise raise
        CalledProcessError.  The CalledProcessError object will have the
        return code in the returncode attribute.
    
        The arguments are the same as for the call function.  Example:
    
        check_call(["ls", "-l"])
        """
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           subprocess.CalledProcessError: Command '['meson', 'setup', '--vsenv', '..']' returned non-zero exit status 1.

cmd        = ['meson', 'setup', '--vsenv', '..']
kwargs     = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0/mem_policy/build')}
popenargs  = (['meson', 'setup', '--vsenv', '..'],)
retcode    = 1

../../python3.13/subprocess.py:421: CalledProcessError

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0')

    @pytest.fixture
    def get_module(tmp_path):
        """ Add a memory policy that returns a false pointer 64 bytes into the
        actual allocation, and fill the prefix with some text. Then check at each
        memory manipulation that the prefix exists, to make sure all alloc/realloc/
        free/calloc go via the functions here.
        """
        if sys.platform.startswith('cygwin'):
            pytest.skip('link fails on cygwin')
        if IS_WASM:
            pytest.skip("Can't build module inside Wasm")
        if IS_EDITABLE:
            pytest.skip("Can't build module for editable install")
    
        functions = [
            ("get_default_policy", "METH_NOARGS", """
                 Py_INCREF(PyDataMem_DefaultHandler);
                 return PyDataMem_DefaultHandler;
             """),
            ("set_secret_data_policy", "METH_NOARGS", """
                 PyObject *secret_data =
                     PyCapsule_New(&secret_data_handler, "mem_handler", NULL);
                 if (secret_data == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(secret_data);
                 Py_DECREF(secret_data);
                 return old;
             """),
            ("set_wrong_capsule_name_data_policy", "METH_NOARGS", """
                 PyObject *wrong_name_capsule =
                     PyCapsule_New(&secret_data_handler, "not_mem_handler", NULL);
                 if (wrong_name_capsule == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(wrong_name_capsule);
                 Py_DECREF(wrong_name_capsule);
                 return old;
             """),
            ("set_old_policy", "METH_O", """
                 PyObject *old;
                 if (args != NULL && PyCapsule_CheckExact(args)) {
                     old = PyDataMem_SetHandler(args);
                 }
                 else {
                     old = PyDataMem_SetHandler(NULL);
                 }
                 return old;
             """),
            ("get_array", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                return PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims, NULL,
                                            buf, NPY_ARRAY_WRITEABLE, NULL);
             """),
            ("set_own", "METH_O", """
                if (!PyArray_Check(args)) {
                    PyErr_SetString(PyExc_ValueError,
                                 "need an ndarray");
                    return NULL;
                }
                PyArray_ENABLEFLAGS((PyArrayObject*)args, NPY_ARRAY_OWNDATA);
                // Maybe try this too?
                // PyArray_BASE(PyArrayObject *)args) = NULL;
                Py_RETURN_NONE;
             """),
            ("get_array_with_base", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                PyObject *arr = PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims,
                                                     NULL, buf,
                                                     NPY_ARRAY_WRITEABLE, NULL);
                if (arr == NULL) return NULL;
                PyObject *obj = PyCapsule_New(buf, "buf capsule",
                                              (PyCapsule_Destructor)&warn_on_free);
                if (obj == NULL) {
                    Py_DECREF(arr);
                    return NULL;
                }
                if (PyArray_SetBaseObject((PyArrayObject *)arr, obj) < 0) {
                    Py_DECREF(arr);
                    Py_DECREF(obj);
                    return NULL;
                }
                return arr;
    
             """),
        ]
        prologue = '''
            #define NPY_TARGET_VERSION NPY_1_22_API_VERSION
            #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
            #include <numpy/arrayobject.h>
            /*
             * This struct allows the dynamic configuration of the allocator funcs
             * of the `secret_data_allocator`. It is provided here for
             * demonstration purposes, as a valid `ctx` use-case scenario.
             */
            typedef struct {
                void *(*malloc)(size_t);
                void *(*calloc)(size_t, size_t);
                void *(*realloc)(void *, size_t);
                void (*free)(void *);
            } SecretDataAllocatorFuncs;
    
            NPY_NO_EXPORT void *
            shift_alloc(void *ctx, size_t sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->malloc(sz + 64);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld", (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void *
            shift_zero(void *ctx, size_t sz, size_t cnt) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->calloc(sz + 64, cnt);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld via zero",
                         (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void
            shift_free(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p == NULL) {
                    return ;
                }
                char *real = (char *)p - 64;
                if (strncmp(real, "originally allocated", 20) != 0) {
                    fprintf(stdout, "uh-oh, unmatched shift_free, "
                            "no appropriate prefix\\n");
                    /* Make C runtime crash by calling free on the wrong address */
                    funcs->free((char *)p + 10);
                    /* funcs->free(real); */
                }
                else {
                    npy_uintp i = (npy_uintp)atoi(real +20);
                    if (i != sz) {
                        fprintf(stderr, "uh-oh, unmatched shift_free"
                                "(ptr, %ld) but allocated %ld\\n", sz, i);
                        /* This happens in some places, only print */
                        funcs->free(real);
                    }
                    else {
                        funcs->free(real);
                    }
                }
            }
            NPY_NO_EXPORT void *
            shift_realloc(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p != NULL) {
                    char *real = (char *)p - 64;
                    if (strncmp(real, "originally allocated", 20) != 0) {
                        fprintf(stdout, "uh-oh, unmatched shift_realloc\\n");
                        return realloc(p, sz);
                    }
                    return (void *)((char *)funcs->realloc(real, sz + 64) + 64);
                }
                else {
                    char *real = (char *)funcs->realloc(p, sz + 64);
                    if (real == NULL) {
                        return NULL;
                    }
                    snprintf(real, 64, "originally allocated "
                             "%ld  via realloc", (unsigned long)sz);
                    return (void *)(real + 64);
                }
            }
            /* As an example, we use the standard {m|c|re}alloc/free funcs. */
            static SecretDataAllocatorFuncs secret_data_handler_ctx = {
                malloc,
                calloc,
                realloc,
                free
            };
            static PyDataMem_Handler secret_data_handler = {
                "secret_data_allocator",
                1,
                {
                    &secret_data_handler_ctx, /* ctx */
                    shift_alloc,              /* malloc */
                    shift_zero,               /* calloc */
                    shift_realloc,            /* realloc */
                    shift_free                /* free */
                }
            };
            void warn_on_free(void *capsule) {
                PyErr_WarnEx(PyExc_UserWarning, "in warn_on_free", 1);
                void * obj = PyCapsule_GetPointer(capsule,
                                                  PyCapsule_GetName(capsule));
                free(obj);
            };
            '''
        more_init = "import_array();"
        try:
            import mem_policy
            return mem_policy
        except ImportError:
            pass
        # if it does not exist, build and load it
>       return extbuild.build_and_import_extension('mem_policy',
                                                   functions,
                                                   prologue=prologue,
                                                   include_dirs=[np.get_include()],
                                                   build_dir=tmp_path,
                                                   more_init=more_init)

functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
tmp_path   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0')

../../python3.13/site-packages/numpy/_core/tests/test_mem_policy.py:223: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
            mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)
        except Exception as e:
            # shorten the exception chain
>           raise RuntimeError(f"could not compile in {build_dir}:") from e
E           RuntimeError: could not compile in /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0:

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:76: RuntimeError
---------------------------- Captured stdout setup -----------------------------
The Meson build system
Version: 1.7.2
Source dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0/mem_policy
Build dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0/mem_policy/build
Build type: native build
Project name: foo
Project version: undefined

../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
The following exception(s) were encountered:
Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"
Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"

A full log can be found at /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_policy_propagation0/mem_policy/build/meson-logs/meson-log.txt
___________________ ERROR at setup of test_context_locality ____________________

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
>           mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:111: in compile_extension_module
    return _c_compile(
        builddir   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0/mem_policy/source.c')
        dirname    = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0/mem_policy')
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        modname    = 'mem_policy'
        name       = 'mem_policy'
        source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:209: in _c_compile
    build(
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:243: in build
    subprocess.check_call(["meson", "setup", "--vsenv", ".."],
        build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0/mem_policy/build')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        fid        = <_io.TextIOWrapper name='/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0/mem_policy/meson.build' mode='wt' encoding='utf-8'>
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        includes   = ['-I/usr/lib/python3.13/site-packages/numpy/_core/include', '-I/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_dirs  = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
        so_name    = 'mem_policy.cpython-313-aarch64-linux-gnu.so'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['meson', 'setup', '--vsenv', '..'],)
kwargs = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0/mem_policy/build')}
retcode = 1, cmd = ['meson', 'setup', '--vsenv', '..']

    def check_call(*popenargs, **kwargs):
        """Run command with arguments.  Wait for command to complete.  If
        the exit code was zero then return, otherwise raise
        CalledProcessError.  The CalledProcessError object will have the
        return code in the returncode attribute.
    
        The arguments are the same as for the call function.  Example:
    
        check_call(["ls", "-l"])
        """
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           subprocess.CalledProcessError: Command '['meson', 'setup', '--vsenv', '..']' returned non-zero exit status 1.

cmd        = ['meson', 'setup', '--vsenv', '..']
kwargs     = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0/mem_policy/build')}
popenargs  = (['meson', 'setup', '--vsenv', '..'],)
retcode    = 1

../../python3.13/subprocess.py:421: CalledProcessError

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0')

    @pytest.fixture
    def get_module(tmp_path):
        """ Add a memory policy that returns a false pointer 64 bytes into the
        actual allocation, and fill the prefix with some text. Then check at each
        memory manipulation that the prefix exists, to make sure all alloc/realloc/
        free/calloc go via the functions here.
        """
        if sys.platform.startswith('cygwin'):
            pytest.skip('link fails on cygwin')
        if IS_WASM:
            pytest.skip("Can't build module inside Wasm")
        if IS_EDITABLE:
            pytest.skip("Can't build module for editable install")
    
        functions = [
            ("get_default_policy", "METH_NOARGS", """
                 Py_INCREF(PyDataMem_DefaultHandler);
                 return PyDataMem_DefaultHandler;
             """),
            ("set_secret_data_policy", "METH_NOARGS", """
                 PyObject *secret_data =
                     PyCapsule_New(&secret_data_handler, "mem_handler", NULL);
                 if (secret_data == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(secret_data);
                 Py_DECREF(secret_data);
                 return old;
             """),
            ("set_wrong_capsule_name_data_policy", "METH_NOARGS", """
                 PyObject *wrong_name_capsule =
                     PyCapsule_New(&secret_data_handler, "not_mem_handler", NULL);
                 if (wrong_name_capsule == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(wrong_name_capsule);
                 Py_DECREF(wrong_name_capsule);
                 return old;
             """),
            ("set_old_policy", "METH_O", """
                 PyObject *old;
                 if (args != NULL && PyCapsule_CheckExact(args)) {
                     old = PyDataMem_SetHandler(args);
                 }
                 else {
                     old = PyDataMem_SetHandler(NULL);
                 }
                 return old;
             """),
            ("get_array", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                return PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims, NULL,
                                            buf, NPY_ARRAY_WRITEABLE, NULL);
             """),
            ("set_own", "METH_O", """
                if (!PyArray_Check(args)) {
                    PyErr_SetString(PyExc_ValueError,
                                 "need an ndarray");
                    return NULL;
                }
                PyArray_ENABLEFLAGS((PyArrayObject*)args, NPY_ARRAY_OWNDATA);
                // Maybe try this too?
                // PyArray_BASE(PyArrayObject *)args) = NULL;
                Py_RETURN_NONE;
             """),
            ("get_array_with_base", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                PyObject *arr = PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims,
                                                     NULL, buf,
                                                     NPY_ARRAY_WRITEABLE, NULL);
                if (arr == NULL) return NULL;
                PyObject *obj = PyCapsule_New(buf, "buf capsule",
                                              (PyCapsule_Destructor)&warn_on_free);
                if (obj == NULL) {
                    Py_DECREF(arr);
                    return NULL;
                }
                if (PyArray_SetBaseObject((PyArrayObject *)arr, obj) < 0) {
                    Py_DECREF(arr);
                    Py_DECREF(obj);
                    return NULL;
                }
                return arr;
    
             """),
        ]
        prologue = '''
            #define NPY_TARGET_VERSION NPY_1_22_API_VERSION
            #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
            #include <numpy/arrayobject.h>
            /*
             * This struct allows the dynamic configuration of the allocator funcs
             * of the `secret_data_allocator`. It is provided here for
             * demonstration purposes, as a valid `ctx` use-case scenario.
             */
            typedef struct {
                void *(*malloc)(size_t);
                void *(*calloc)(size_t, size_t);
                void *(*realloc)(void *, size_t);
                void (*free)(void *);
            } SecretDataAllocatorFuncs;
    
            NPY_NO_EXPORT void *
            shift_alloc(void *ctx, size_t sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->malloc(sz + 64);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld", (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void *
            shift_zero(void *ctx, size_t sz, size_t cnt) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->calloc(sz + 64, cnt);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld via zero",
                         (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void
            shift_free(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p == NULL) {
                    return ;
                }
                char *real = (char *)p - 64;
                if (strncmp(real, "originally allocated", 20) != 0) {
                    fprintf(stdout, "uh-oh, unmatched shift_free, "
                            "no appropriate prefix\\n");
                    /* Make C runtime crash by calling free on the wrong address */
                    funcs->free((char *)p + 10);
                    /* funcs->free(real); */
                }
                else {
                    npy_uintp i = (npy_uintp)atoi(real +20);
                    if (i != sz) {
                        fprintf(stderr, "uh-oh, unmatched shift_free"
                                "(ptr, %ld) but allocated %ld\\n", sz, i);
                        /* This happens in some places, only print */
                        funcs->free(real);
                    }
                    else {
                        funcs->free(real);
                    }
                }
            }
            NPY_NO_EXPORT void *
            shift_realloc(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p != NULL) {
                    char *real = (char *)p - 64;
                    if (strncmp(real, "originally allocated", 20) != 0) {
                        fprintf(stdout, "uh-oh, unmatched shift_realloc\\n");
                        return realloc(p, sz);
                    }
                    return (void *)((char *)funcs->realloc(real, sz + 64) + 64);
                }
                else {
                    char *real = (char *)funcs->realloc(p, sz + 64);
                    if (real == NULL) {
                        return NULL;
                    }
                    snprintf(real, 64, "originally allocated "
                             "%ld  via realloc", (unsigned long)sz);
                    return (void *)(real + 64);
                }
            }
            /* As an example, we use the standard {m|c|re}alloc/free funcs. */
            static SecretDataAllocatorFuncs secret_data_handler_ctx = {
                malloc,
                calloc,
                realloc,
                free
            };
            static PyDataMem_Handler secret_data_handler = {
                "secret_data_allocator",
                1,
                {
                    &secret_data_handler_ctx, /* ctx */
                    shift_alloc,              /* malloc */
                    shift_zero,               /* calloc */
                    shift_realloc,            /* realloc */
                    shift_free                /* free */
                }
            };
            void warn_on_free(void *capsule) {
                PyErr_WarnEx(PyExc_UserWarning, "in warn_on_free", 1);
                void * obj = PyCapsule_GetPointer(capsule,
                                                  PyCapsule_GetName(capsule));
                free(obj);
            };
            '''
        more_init = "import_array();"
        try:
            import mem_policy
            return mem_policy
        except ImportError:
            pass
        # if it does not exist, build and load it
>       return extbuild.build_and_import_extension('mem_policy',
                                                   functions,
                                                   prologue=prologue,
                                                   include_dirs=[np.get_include()],
                                                   build_dir=tmp_path,
                                                   more_init=more_init)

functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
tmp_path   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0')

../../python3.13/site-packages/numpy/_core/tests/test_mem_policy.py:223: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
            mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)
        except Exception as e:
            # shorten the exception chain
>           raise RuntimeError(f"could not compile in {build_dir}:") from e
E           RuntimeError: could not compile in /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0:

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:76: RuntimeError
---------------------------- Captured stdout setup -----------------------------
The Meson build system
Version: 1.7.2
Source dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0/mem_policy
Build dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0/mem_policy/build
Build type: native build
Project name: foo
Project version: undefined

../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
The following exception(s) were encountered:
Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"
Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"

A full log can be found at /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_context_locality0/mem_policy/build/meson-logs/meson-log.txt
____________________ ERROR at setup of test_thread_locality ____________________

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
>           mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:111: in compile_extension_module
    return _c_compile(
        builddir   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0/mem_policy/source.c')
        dirname    = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0/mem_policy')
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        modname    = 'mem_policy'
        name       = 'mem_policy'
        source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:209: in _c_compile
    build(
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:243: in build
    subprocess.check_call(["meson", "setup", "--vsenv", ".."],
        build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0/mem_policy/build')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        fid        = <_io.TextIOWrapper name='/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0/mem_policy/meson.build' mode='wt' encoding='utf-8'>
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        includes   = ['-I/usr/lib/python3.13/site-packages/numpy/_core/include', '-I/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_dirs  = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
        so_name    = 'mem_policy.cpython-313-aarch64-linux-gnu.so'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['meson', 'setup', '--vsenv', '..'],)
kwargs = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0/mem_policy/build')}
retcode = 1, cmd = ['meson', 'setup', '--vsenv', '..']

    def check_call(*popenargs, **kwargs):
        """Run command with arguments.  Wait for command to complete.  If
        the exit code was zero then return, otherwise raise
        CalledProcessError.  The CalledProcessError object will have the
        return code in the returncode attribute.
    
        The arguments are the same as for the call function.  Example:
    
        check_call(["ls", "-l"])
        """
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           subprocess.CalledProcessError: Command '['meson', 'setup', '--vsenv', '..']' returned non-zero exit status 1.

cmd        = ['meson', 'setup', '--vsenv', '..']
kwargs     = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0/mem_policy/build')}
popenargs  = (['meson', 'setup', '--vsenv', '..'],)
retcode    = 1

../../python3.13/subprocess.py:421: CalledProcessError

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0')

    @pytest.fixture
    def get_module(tmp_path):
        """ Add a memory policy that returns a false pointer 64 bytes into the
        actual allocation, and fill the prefix with some text. Then check at each
        memory manipulation that the prefix exists, to make sure all alloc/realloc/
        free/calloc go via the functions here.
        """
        if sys.platform.startswith('cygwin'):
            pytest.skip('link fails on cygwin')
        if IS_WASM:
            pytest.skip("Can't build module inside Wasm")
        if IS_EDITABLE:
            pytest.skip("Can't build module for editable install")
    
        functions = [
            ("get_default_policy", "METH_NOARGS", """
                 Py_INCREF(PyDataMem_DefaultHandler);
                 return PyDataMem_DefaultHandler;
             """),
            ("set_secret_data_policy", "METH_NOARGS", """
                 PyObject *secret_data =
                     PyCapsule_New(&secret_data_handler, "mem_handler", NULL);
                 if (secret_data == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(secret_data);
                 Py_DECREF(secret_data);
                 return old;
             """),
            ("set_wrong_capsule_name_data_policy", "METH_NOARGS", """
                 PyObject *wrong_name_capsule =
                     PyCapsule_New(&secret_data_handler, "not_mem_handler", NULL);
                 if (wrong_name_capsule == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(wrong_name_capsule);
                 Py_DECREF(wrong_name_capsule);
                 return old;
             """),
            ("set_old_policy", "METH_O", """
                 PyObject *old;
                 if (args != NULL && PyCapsule_CheckExact(args)) {
                     old = PyDataMem_SetHandler(args);
                 }
                 else {
                     old = PyDataMem_SetHandler(NULL);
                 }
                 return old;
             """),
            ("get_array", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                return PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims, NULL,
                                            buf, NPY_ARRAY_WRITEABLE, NULL);
             """),
            ("set_own", "METH_O", """
                if (!PyArray_Check(args)) {
                    PyErr_SetString(PyExc_ValueError,
                                 "need an ndarray");
                    return NULL;
                }
                PyArray_ENABLEFLAGS((PyArrayObject*)args, NPY_ARRAY_OWNDATA);
                // Maybe try this too?
                // PyArray_BASE(PyArrayObject *)args) = NULL;
                Py_RETURN_NONE;
             """),
            ("get_array_with_base", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                PyObject *arr = PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims,
                                                     NULL, buf,
                                                     NPY_ARRAY_WRITEABLE, NULL);
                if (arr == NULL) return NULL;
                PyObject *obj = PyCapsule_New(buf, "buf capsule",
                                              (PyCapsule_Destructor)&warn_on_free);
                if (obj == NULL) {
                    Py_DECREF(arr);
                    return NULL;
                }
                if (PyArray_SetBaseObject((PyArrayObject *)arr, obj) < 0) {
                    Py_DECREF(arr);
                    Py_DECREF(obj);
                    return NULL;
                }
                return arr;
    
             """),
        ]
        prologue = '''
            #define NPY_TARGET_VERSION NPY_1_22_API_VERSION
            #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
            #include <numpy/arrayobject.h>
            /*
             * This struct allows the dynamic configuration of the allocator funcs
             * of the `secret_data_allocator`. It is provided here for
             * demonstration purposes, as a valid `ctx` use-case scenario.
             */
            typedef struct {
                void *(*malloc)(size_t);
                void *(*calloc)(size_t, size_t);
                void *(*realloc)(void *, size_t);
                void (*free)(void *);
            } SecretDataAllocatorFuncs;
    
            NPY_NO_EXPORT void *
            shift_alloc(void *ctx, size_t sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->malloc(sz + 64);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld", (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void *
            shift_zero(void *ctx, size_t sz, size_t cnt) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->calloc(sz + 64, cnt);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld via zero",
                         (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void
            shift_free(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p == NULL) {
                    return ;
                }
                char *real = (char *)p - 64;
                if (strncmp(real, "originally allocated", 20) != 0) {
                    fprintf(stdout, "uh-oh, unmatched shift_free, "
                            "no appropriate prefix\\n");
                    /* Make C runtime crash by calling free on the wrong address */
                    funcs->free((char *)p + 10);
                    /* funcs->free(real); */
                }
                else {
                    npy_uintp i = (npy_uintp)atoi(real +20);
                    if (i != sz) {
                        fprintf(stderr, "uh-oh, unmatched shift_free"
                                "(ptr, %ld) but allocated %ld\\n", sz, i);
                        /* This happens in some places, only print */
                        funcs->free(real);
                    }
                    else {
                        funcs->free(real);
                    }
                }
            }
            NPY_NO_EXPORT void *
            shift_realloc(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p != NULL) {
                    char *real = (char *)p - 64;
                    if (strncmp(real, "originally allocated", 20) != 0) {
                        fprintf(stdout, "uh-oh, unmatched shift_realloc\\n");
                        return realloc(p, sz);
                    }
                    return (void *)((char *)funcs->realloc(real, sz + 64) + 64);
                }
                else {
                    char *real = (char *)funcs->realloc(p, sz + 64);
                    if (real == NULL) {
                        return NULL;
                    }
                    snprintf(real, 64, "originally allocated "
                             "%ld  via realloc", (unsigned long)sz);
                    return (void *)(real + 64);
                }
            }
            /* As an example, we use the standard {m|c|re}alloc/free funcs. */
            static SecretDataAllocatorFuncs secret_data_handler_ctx = {
                malloc,
                calloc,
                realloc,
                free
            };
            static PyDataMem_Handler secret_data_handler = {
                "secret_data_allocator",
                1,
                {
                    &secret_data_handler_ctx, /* ctx */
                    shift_alloc,              /* malloc */
                    shift_zero,               /* calloc */
                    shift_realloc,            /* realloc */
                    shift_free                /* free */
                }
            };
            void warn_on_free(void *capsule) {
                PyErr_WarnEx(PyExc_UserWarning, "in warn_on_free", 1);
                void * obj = PyCapsule_GetPointer(capsule,
                                                  PyCapsule_GetName(capsule));
                free(obj);
            };
            '''
        more_init = "import_array();"
        try:
            import mem_policy
            return mem_policy
        except ImportError:
            pass
        # if it does not exist, build and load it
>       return extbuild.build_and_import_extension('mem_policy',
                                                   functions,
                                                   prologue=prologue,
                                                   include_dirs=[np.get_include()],
                                                   build_dir=tmp_path,
                                                   more_init=more_init)

functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
tmp_path   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0')

../../python3.13/site-packages/numpy/_core/tests/test_mem_policy.py:223: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
            mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)
        except Exception as e:
            # shorten the exception chain
>           raise RuntimeError(f"could not compile in {build_dir}:") from e
E           RuntimeError: could not compile in /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0:

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:76: RuntimeError
---------------------------- Captured stdout setup -----------------------------
The Meson build system
Version: 1.7.2
Source dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0/mem_policy
Build dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0/mem_policy/build
Build type: native build
Project name: foo
Project version: undefined

../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
The following exception(s) were encountered:
Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"
Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"

A full log can be found at /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_thread_locality0/mem_policy/build/meson-logs/meson-log.txt
____________________ ERROR at setup of test_switch_owner[0] ____________________

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
>           mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:111: in compile_extension_module
    return _c_compile(
        builddir   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0/mem_policy/source.c')
        dirname    = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0/mem_policy')
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        modname    = 'mem_policy'
        name       = 'mem_policy'
        source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:209: in _c_compile
    build(
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:243: in build
    subprocess.check_call(["meson", "setup", "--vsenv", ".."],
        build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0/mem_policy/build')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        fid        = <_io.TextIOWrapper name='/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0/mem_policy/meson.build' mode='wt' encoding='utf-8'>
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        includes   = ['-I/usr/lib/python3.13/site-packages/numpy/_core/include', '-I/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_dirs  = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
        so_name    = 'mem_policy.cpython-313-aarch64-linux-gnu.so'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['meson', 'setup', '--vsenv', '..'],)
kwargs = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0/mem_policy/build')}
retcode = 1, cmd = ['meson', 'setup', '--vsenv', '..']

    def check_call(*popenargs, **kwargs):
        """Run command with arguments.  Wait for command to complete.  If
        the exit code was zero then return, otherwise raise
        CalledProcessError.  The CalledProcessError object will have the
        return code in the returncode attribute.
    
        The arguments are the same as for the call function.  Example:
    
        check_call(["ls", "-l"])
        """
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           subprocess.CalledProcessError: Command '['meson', 'setup', '--vsenv', '..']' returned non-zero exit status 1.

cmd        = ['meson', 'setup', '--vsenv', '..']
kwargs     = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0/mem_policy/build')}
popenargs  = (['meson', 'setup', '--vsenv', '..'],)
retcode    = 1

../../python3.13/subprocess.py:421: CalledProcessError

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0')

    @pytest.fixture
    def get_module(tmp_path):
        """ Add a memory policy that returns a false pointer 64 bytes into the
        actual allocation, and fill the prefix with some text. Then check at each
        memory manipulation that the prefix exists, to make sure all alloc/realloc/
        free/calloc go via the functions here.
        """
        if sys.platform.startswith('cygwin'):
            pytest.skip('link fails on cygwin')
        if IS_WASM:
            pytest.skip("Can't build module inside Wasm")
        if IS_EDITABLE:
            pytest.skip("Can't build module for editable install")
    
        functions = [
            ("get_default_policy", "METH_NOARGS", """
                 Py_INCREF(PyDataMem_DefaultHandler);
                 return PyDataMem_DefaultHandler;
             """),
            ("set_secret_data_policy", "METH_NOARGS", """
                 PyObject *secret_data =
                     PyCapsule_New(&secret_data_handler, "mem_handler", NULL);
                 if (secret_data == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(secret_data);
                 Py_DECREF(secret_data);
                 return old;
             """),
            ("set_wrong_capsule_name_data_policy", "METH_NOARGS", """
                 PyObject *wrong_name_capsule =
                     PyCapsule_New(&secret_data_handler, "not_mem_handler", NULL);
                 if (wrong_name_capsule == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(wrong_name_capsule);
                 Py_DECREF(wrong_name_capsule);
                 return old;
             """),
            ("set_old_policy", "METH_O", """
                 PyObject *old;
                 if (args != NULL && PyCapsule_CheckExact(args)) {
                     old = PyDataMem_SetHandler(args);
                 }
                 else {
                     old = PyDataMem_SetHandler(NULL);
                 }
                 return old;
             """),
            ("get_array", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                return PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims, NULL,
                                            buf, NPY_ARRAY_WRITEABLE, NULL);
             """),
            ("set_own", "METH_O", """
                if (!PyArray_Check(args)) {
                    PyErr_SetString(PyExc_ValueError,
                                 "need an ndarray");
                    return NULL;
                }
                PyArray_ENABLEFLAGS((PyArrayObject*)args, NPY_ARRAY_OWNDATA);
                // Maybe try this too?
                // PyArray_BASE(PyArrayObject *)args) = NULL;
                Py_RETURN_NONE;
             """),
            ("get_array_with_base", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                PyObject *arr = PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims,
                                                     NULL, buf,
                                                     NPY_ARRAY_WRITEABLE, NULL);
                if (arr == NULL) return NULL;
                PyObject *obj = PyCapsule_New(buf, "buf capsule",
                                              (PyCapsule_Destructor)&warn_on_free);
                if (obj == NULL) {
                    Py_DECREF(arr);
                    return NULL;
                }
                if (PyArray_SetBaseObject((PyArrayObject *)arr, obj) < 0) {
                    Py_DECREF(arr);
                    Py_DECREF(obj);
                    return NULL;
                }
                return arr;
    
             """),
        ]
        prologue = '''
            #define NPY_TARGET_VERSION NPY_1_22_API_VERSION
            #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
            #include <numpy/arrayobject.h>
            /*
             * This struct allows the dynamic configuration of the allocator funcs
             * of the `secret_data_allocator`. It is provided here for
             * demonstration purposes, as a valid `ctx` use-case scenario.
             */
            typedef struct {
                void *(*malloc)(size_t);
                void *(*calloc)(size_t, size_t);
                void *(*realloc)(void *, size_t);
                void (*free)(void *);
            } SecretDataAllocatorFuncs;
    
            NPY_NO_EXPORT void *
            shift_alloc(void *ctx, size_t sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->malloc(sz + 64);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld", (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void *
            shift_zero(void *ctx, size_t sz, size_t cnt) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->calloc(sz + 64, cnt);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld via zero",
                         (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void
            shift_free(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p == NULL) {
                    return ;
                }
                char *real = (char *)p - 64;
                if (strncmp(real, "originally allocated", 20) != 0) {
                    fprintf(stdout, "uh-oh, unmatched shift_free, "
                            "no appropriate prefix\\n");
                    /* Make C runtime crash by calling free on the wrong address */
                    funcs->free((char *)p + 10);
                    /* funcs->free(real); */
                }
                else {
                    npy_uintp i = (npy_uintp)atoi(real +20);
                    if (i != sz) {
                        fprintf(stderr, "uh-oh, unmatched shift_free"
                                "(ptr, %ld) but allocated %ld\\n", sz, i);
                        /* This happens in some places, only print */
                        funcs->free(real);
                    }
                    else {
                        funcs->free(real);
                    }
                }
            }
            NPY_NO_EXPORT void *
            shift_realloc(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p != NULL) {
                    char *real = (char *)p - 64;
                    if (strncmp(real, "originally allocated", 20) != 0) {
                        fprintf(stdout, "uh-oh, unmatched shift_realloc\\n");
                        return realloc(p, sz);
                    }
                    return (void *)((char *)funcs->realloc(real, sz + 64) + 64);
                }
                else {
                    char *real = (char *)funcs->realloc(p, sz + 64);
                    if (real == NULL) {
                        return NULL;
                    }
                    snprintf(real, 64, "originally allocated "
                             "%ld  via realloc", (unsigned long)sz);
                    return (void *)(real + 64);
                }
            }
            /* As an example, we use the standard {m|c|re}alloc/free funcs. */
            static SecretDataAllocatorFuncs secret_data_handler_ctx = {
                malloc,
                calloc,
                realloc,
                free
            };
            static PyDataMem_Handler secret_data_handler = {
                "secret_data_allocator",
                1,
                {
                    &secret_data_handler_ctx, /* ctx */
                    shift_alloc,              /* malloc */
                    shift_zero,               /* calloc */
                    shift_realloc,            /* realloc */
                    shift_free                /* free */
                }
            };
            void warn_on_free(void *capsule) {
                PyErr_WarnEx(PyExc_UserWarning, "in warn_on_free", 1);
                void * obj = PyCapsule_GetPointer(capsule,
                                                  PyCapsule_GetName(capsule));
                free(obj);
            };
            '''
        more_init = "import_array();"
        try:
            import mem_policy
            return mem_policy
        except ImportError:
            pass
        # if it does not exist, build and load it
>       return extbuild.build_and_import_extension('mem_policy',
                                                   functions,
                                                   prologue=prologue,
                                                   include_dirs=[np.get_include()],
                                                   build_dir=tmp_path,
                                                   more_init=more_init)

functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
tmp_path   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0')

../../python3.13/site-packages/numpy/_core/tests/test_mem_policy.py:223: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
            mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)
        except Exception as e:
            # shorten the exception chain
>           raise RuntimeError(f"could not compile in {build_dir}:") from e
E           RuntimeError: could not compile in /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0:

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:76: RuntimeError
---------------------------- Captured stdout setup -----------------------------
The Meson build system
Version: 1.7.2
Source dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0/mem_policy
Build dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0/mem_policy/build
Build type: native build
Project name: foo
Project version: undefined

../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
The following exception(s) were encountered:
Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"
Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"

A full log can be found at /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_0_0/mem_policy/build/meson-logs/meson-log.txt
____________________ ERROR at setup of test_switch_owner[1] ____________________

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
>           mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:111: in compile_extension_module
    return _c_compile(
        builddir   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0/mem_policy/source.c')
        dirname    = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0/mem_policy')
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        modname    = 'mem_policy'
        name       = 'mem_policy'
        source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:209: in _c_compile
    build(
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:243: in build
    subprocess.check_call(["meson", "setup", "--vsenv", ".."],
        build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0/mem_policy/build')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        fid        = <_io.TextIOWrapper name='/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0/mem_policy/meson.build' mode='wt' encoding='utf-8'>
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        includes   = ['-I/usr/lib/python3.13/site-packages/numpy/_core/include', '-I/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_dirs  = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
        so_name    = 'mem_policy.cpython-313-aarch64-linux-gnu.so'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['meson', 'setup', '--vsenv', '..'],)
kwargs = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0/mem_policy/build')}
retcode = 1, cmd = ['meson', 'setup', '--vsenv', '..']

    def check_call(*popenargs, **kwargs):
        """Run command with arguments.  Wait for command to complete.  If
        the exit code was zero then return, otherwise raise
        CalledProcessError.  The CalledProcessError object will have the
        return code in the returncode attribute.
    
        The arguments are the same as for the call function.  Example:
    
        check_call(["ls", "-l"])
        """
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           subprocess.CalledProcessError: Command '['meson', 'setup', '--vsenv', '..']' returned non-zero exit status 1.

cmd        = ['meson', 'setup', '--vsenv', '..']
kwargs     = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0/mem_policy/build')}
popenargs  = (['meson', 'setup', '--vsenv', '..'],)
retcode    = 1

../../python3.13/subprocess.py:421: CalledProcessError

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0')

    @pytest.fixture
    def get_module(tmp_path):
        """ Add a memory policy that returns a false pointer 64 bytes into the
        actual allocation, and fill the prefix with some text. Then check at each
        memory manipulation that the prefix exists, to make sure all alloc/realloc/
        free/calloc go via the functions here.
        """
        if sys.platform.startswith('cygwin'):
            pytest.skip('link fails on cygwin')
        if IS_WASM:
            pytest.skip("Can't build module inside Wasm")
        if IS_EDITABLE:
            pytest.skip("Can't build module for editable install")
    
        functions = [
            ("get_default_policy", "METH_NOARGS", """
                 Py_INCREF(PyDataMem_DefaultHandler);
                 return PyDataMem_DefaultHandler;
             """),
            ("set_secret_data_policy", "METH_NOARGS", """
                 PyObject *secret_data =
                     PyCapsule_New(&secret_data_handler, "mem_handler", NULL);
                 if (secret_data == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(secret_data);
                 Py_DECREF(secret_data);
                 return old;
             """),
            ("set_wrong_capsule_name_data_policy", "METH_NOARGS", """
                 PyObject *wrong_name_capsule =
                     PyCapsule_New(&secret_data_handler, "not_mem_handler", NULL);
                 if (wrong_name_capsule == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(wrong_name_capsule);
                 Py_DECREF(wrong_name_capsule);
                 return old;
             """),
            ("set_old_policy", "METH_O", """
                 PyObject *old;
                 if (args != NULL && PyCapsule_CheckExact(args)) {
                     old = PyDataMem_SetHandler(args);
                 }
                 else {
                     old = PyDataMem_SetHandler(NULL);
                 }
                 return old;
             """),
            ("get_array", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                return PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims, NULL,
                                            buf, NPY_ARRAY_WRITEABLE, NULL);
             """),
            ("set_own", "METH_O", """
                if (!PyArray_Check(args)) {
                    PyErr_SetString(PyExc_ValueError,
                                 "need an ndarray");
                    return NULL;
                }
                PyArray_ENABLEFLAGS((PyArrayObject*)args, NPY_ARRAY_OWNDATA);
                // Maybe try this too?
                // PyArray_BASE(PyArrayObject *)args) = NULL;
                Py_RETURN_NONE;
             """),
            ("get_array_with_base", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                PyObject *arr = PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims,
                                                     NULL, buf,
                                                     NPY_ARRAY_WRITEABLE, NULL);
                if (arr == NULL) return NULL;
                PyObject *obj = PyCapsule_New(buf, "buf capsule",
                                              (PyCapsule_Destructor)&warn_on_free);
                if (obj == NULL) {
                    Py_DECREF(arr);
                    return NULL;
                }
                if (PyArray_SetBaseObject((PyArrayObject *)arr, obj) < 0) {
                    Py_DECREF(arr);
                    Py_DECREF(obj);
                    return NULL;
                }
                return arr;
    
             """),
        ]
        prologue = '''
            #define NPY_TARGET_VERSION NPY_1_22_API_VERSION
            #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
            #include <numpy/arrayobject.h>
            /*
             * This struct allows the dynamic configuration of the allocator funcs
             * of the `secret_data_allocator`. It is provided here for
             * demonstration purposes, as a valid `ctx` use-case scenario.
             */
            typedef struct {
                void *(*malloc)(size_t);
                void *(*calloc)(size_t, size_t);
                void *(*realloc)(void *, size_t);
                void (*free)(void *);
            } SecretDataAllocatorFuncs;
    
            NPY_NO_EXPORT void *
            shift_alloc(void *ctx, size_t sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->malloc(sz + 64);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld", (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void *
            shift_zero(void *ctx, size_t sz, size_t cnt) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->calloc(sz + 64, cnt);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld via zero",
                         (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void
            shift_free(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p == NULL) {
                    return ;
                }
                char *real = (char *)p - 64;
                if (strncmp(real, "originally allocated", 20) != 0) {
                    fprintf(stdout, "uh-oh, unmatched shift_free, "
                            "no appropriate prefix\\n");
                    /* Make C runtime crash by calling free on the wrong address */
                    funcs->free((char *)p + 10);
                    /* funcs->free(real); */
                }
                else {
                    npy_uintp i = (npy_uintp)atoi(real +20);
                    if (i != sz) {
                        fprintf(stderr, "uh-oh, unmatched shift_free"
                                "(ptr, %ld) but allocated %ld\\n", sz, i);
                        /* This happens in some places, only print */
                        funcs->free(real);
                    }
                    else {
                        funcs->free(real);
                    }
                }
            }
            NPY_NO_EXPORT void *
            shift_realloc(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p != NULL) {
                    char *real = (char *)p - 64;
                    if (strncmp(real, "originally allocated", 20) != 0) {
                        fprintf(stdout, "uh-oh, unmatched shift_realloc\\n");
                        return realloc(p, sz);
                    }
                    return (void *)((char *)funcs->realloc(real, sz + 64) + 64);
                }
                else {
                    char *real = (char *)funcs->realloc(p, sz + 64);
                    if (real == NULL) {
                        return NULL;
                    }
                    snprintf(real, 64, "originally allocated "
                             "%ld  via realloc", (unsigned long)sz);
                    return (void *)(real + 64);
                }
            }
            /* As an example, we use the standard {m|c|re}alloc/free funcs. */
            static SecretDataAllocatorFuncs secret_data_handler_ctx = {
                malloc,
                calloc,
                realloc,
                free
            };
            static PyDataMem_Handler secret_data_handler = {
                "secret_data_allocator",
                1,
                {
                    &secret_data_handler_ctx, /* ctx */
                    shift_alloc,              /* malloc */
                    shift_zero,               /* calloc */
                    shift_realloc,            /* realloc */
                    shift_free                /* free */
                }
            };
            void warn_on_free(void *capsule) {
                PyErr_WarnEx(PyExc_UserWarning, "in warn_on_free", 1);
                void * obj = PyCapsule_GetPointer(capsule,
                                                  PyCapsule_GetName(capsule));
                free(obj);
            };
            '''
        more_init = "import_array();"
        try:
            import mem_policy
            return mem_policy
        except ImportError:
            pass
        # if it does not exist, build and load it
>       return extbuild.build_and_import_extension('mem_policy',
                                                   functions,
                                                   prologue=prologue,
                                                   include_dirs=[np.get_include()],
                                                   build_dir=tmp_path,
                                                   more_init=more_init)

functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
tmp_path   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0')

../../python3.13/site-packages/numpy/_core/tests/test_mem_policy.py:223: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
            mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)
        except Exception as e:
            # shorten the exception chain
>           raise RuntimeError(f"could not compile in {build_dir}:") from e
E           RuntimeError: could not compile in /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0:

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:76: RuntimeError
---------------------------- Captured stdout setup -----------------------------
The Meson build system
Version: 1.7.2
Source dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0/mem_policy
Build dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0/mem_policy/build
Build type: native build
Project name: foo
Project version: undefined

../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
The following exception(s) were encountered:
Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"
Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"

A full log can be found at /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_1_0/mem_policy/build/meson-logs/meson-log.txt
__________________ ERROR at setup of test_switch_owner[None] ___________________

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
>           mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:111: in compile_extension_module
    return _c_compile(
        builddir   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0/mem_policy/source.c')
        dirname    = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0/mem_policy')
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        modname    = 'mem_policy'
        name       = 'mem_policy'
        source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:209: in _c_compile
    build(
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:243: in build
    subprocess.check_call(["meson", "setup", "--vsenv", ".."],
        build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0/mem_policy/build')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        fid        = <_io.TextIOWrapper name='/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0/mem_policy/meson.build' mode='wt' encoding='utf-8'>
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        includes   = ['-I/usr/lib/python3.13/site-packages/numpy/_core/include', '-I/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_dirs  = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
        so_name    = 'mem_policy.cpython-313-aarch64-linux-gnu.so'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['meson', 'setup', '--vsenv', '..'],)
kwargs = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0/mem_policy/build')}
retcode = 1, cmd = ['meson', 'setup', '--vsenv', '..']

    def check_call(*popenargs, **kwargs):
        """Run command with arguments.  Wait for command to complete.  If
        the exit code was zero then return, otherwise raise
        CalledProcessError.  The CalledProcessError object will have the
        return code in the returncode attribute.
    
        The arguments are the same as for the call function.  Example:
    
        check_call(["ls", "-l"])
        """
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           subprocess.CalledProcessError: Command '['meson', 'setup', '--vsenv', '..']' returned non-zero exit status 1.

cmd        = ['meson', 'setup', '--vsenv', '..']
kwargs     = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0/mem_policy/build')}
popenargs  = (['meson', 'setup', '--vsenv', '..'],)
retcode    = 1

../../python3.13/subprocess.py:421: CalledProcessError

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0')

    @pytest.fixture
    def get_module(tmp_path):
        """ Add a memory policy that returns a false pointer 64 bytes into the
        actual allocation, and fill the prefix with some text. Then check at each
        memory manipulation that the prefix exists, to make sure all alloc/realloc/
        free/calloc go via the functions here.
        """
        if sys.platform.startswith('cygwin'):
            pytest.skip('link fails on cygwin')
        if IS_WASM:
            pytest.skip("Can't build module inside Wasm")
        if IS_EDITABLE:
            pytest.skip("Can't build module for editable install")
    
        functions = [
            ("get_default_policy", "METH_NOARGS", """
                 Py_INCREF(PyDataMem_DefaultHandler);
                 return PyDataMem_DefaultHandler;
             """),
            ("set_secret_data_policy", "METH_NOARGS", """
                 PyObject *secret_data =
                     PyCapsule_New(&secret_data_handler, "mem_handler", NULL);
                 if (secret_data == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(secret_data);
                 Py_DECREF(secret_data);
                 return old;
             """),
            ("set_wrong_capsule_name_data_policy", "METH_NOARGS", """
                 PyObject *wrong_name_capsule =
                     PyCapsule_New(&secret_data_handler, "not_mem_handler", NULL);
                 if (wrong_name_capsule == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(wrong_name_capsule);
                 Py_DECREF(wrong_name_capsule);
                 return old;
             """),
            ("set_old_policy", "METH_O", """
                 PyObject *old;
                 if (args != NULL && PyCapsule_CheckExact(args)) {
                     old = PyDataMem_SetHandler(args);
                 }
                 else {
                     old = PyDataMem_SetHandler(NULL);
                 }
                 return old;
             """),
            ("get_array", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                return PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims, NULL,
                                            buf, NPY_ARRAY_WRITEABLE, NULL);
             """),
            ("set_own", "METH_O", """
                if (!PyArray_Check(args)) {
                    PyErr_SetString(PyExc_ValueError,
                                 "need an ndarray");
                    return NULL;
                }
                PyArray_ENABLEFLAGS((PyArrayObject*)args, NPY_ARRAY_OWNDATA);
                // Maybe try this too?
                // PyArray_BASE(PyArrayObject *)args) = NULL;
                Py_RETURN_NONE;
             """),
            ("get_array_with_base", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                PyObject *arr = PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims,
                                                     NULL, buf,
                                                     NPY_ARRAY_WRITEABLE, NULL);
                if (arr == NULL) return NULL;
                PyObject *obj = PyCapsule_New(buf, "buf capsule",
                                              (PyCapsule_Destructor)&warn_on_free);
                if (obj == NULL) {
                    Py_DECREF(arr);
                    return NULL;
                }
                if (PyArray_SetBaseObject((PyArrayObject *)arr, obj) < 0) {
                    Py_DECREF(arr);
                    Py_DECREF(obj);
                    return NULL;
                }
                return arr;
    
             """),
        ]
        prologue = '''
            #define NPY_TARGET_VERSION NPY_1_22_API_VERSION
            #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
            #include <numpy/arrayobject.h>
            /*
             * This struct allows the dynamic configuration of the allocator funcs
             * of the `secret_data_allocator`. It is provided here for
             * demonstration purposes, as a valid `ctx` use-case scenario.
             */
            typedef struct {
                void *(*malloc)(size_t);
                void *(*calloc)(size_t, size_t);
                void *(*realloc)(void *, size_t);
                void (*free)(void *);
            } SecretDataAllocatorFuncs;
    
            NPY_NO_EXPORT void *
            shift_alloc(void *ctx, size_t sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->malloc(sz + 64);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld", (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void *
            shift_zero(void *ctx, size_t sz, size_t cnt) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->calloc(sz + 64, cnt);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld via zero",
                         (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void
            shift_free(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p == NULL) {
                    return ;
                }
                char *real = (char *)p - 64;
                if (strncmp(real, "originally allocated", 20) != 0) {
                    fprintf(stdout, "uh-oh, unmatched shift_free, "
                            "no appropriate prefix\\n");
                    /* Make C runtime crash by calling free on the wrong address */
                    funcs->free((char *)p + 10);
                    /* funcs->free(real); */
                }
                else {
                    npy_uintp i = (npy_uintp)atoi(real +20);
                    if (i != sz) {
                        fprintf(stderr, "uh-oh, unmatched shift_free"
                                "(ptr, %ld) but allocated %ld\\n", sz, i);
                        /* This happens in some places, only print */
                        funcs->free(real);
                    }
                    else {
                        funcs->free(real);
                    }
                }
            }
            NPY_NO_EXPORT void *
            shift_realloc(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p != NULL) {
                    char *real = (char *)p - 64;
                    if (strncmp(real, "originally allocated", 20) != 0) {
                        fprintf(stdout, "uh-oh, unmatched shift_realloc\\n");
                        return realloc(p, sz);
                    }
                    return (void *)((char *)funcs->realloc(real, sz + 64) + 64);
                }
                else {
                    char *real = (char *)funcs->realloc(p, sz + 64);
                    if (real == NULL) {
                        return NULL;
                    }
                    snprintf(real, 64, "originally allocated "
                             "%ld  via realloc", (unsigned long)sz);
                    return (void *)(real + 64);
                }
            }
            /* As an example, we use the standard {m|c|re}alloc/free funcs. */
            static SecretDataAllocatorFuncs secret_data_handler_ctx = {
                malloc,
                calloc,
                realloc,
                free
            };
            static PyDataMem_Handler secret_data_handler = {
                "secret_data_allocator",
                1,
                {
                    &secret_data_handler_ctx, /* ctx */
                    shift_alloc,              /* malloc */
                    shift_zero,               /* calloc */
                    shift_realloc,            /* realloc */
                    shift_free                /* free */
                }
            };
            void warn_on_free(void *capsule) {
                PyErr_WarnEx(PyExc_UserWarning, "in warn_on_free", 1);
                void * obj = PyCapsule_GetPointer(capsule,
                                                  PyCapsule_GetName(capsule));
                free(obj);
            };
            '''
        more_init = "import_array();"
        try:
            import mem_policy
            return mem_policy
        except ImportError:
            pass
        # if it does not exist, build and load it
>       return extbuild.build_and_import_extension('mem_policy',
                                                   functions,
                                                   prologue=prologue,
                                                   include_dirs=[np.get_include()],
                                                   build_dir=tmp_path,
                                                   more_init=more_init)

functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
tmp_path   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0')

../../python3.13/site-packages/numpy/_core/tests/test_mem_policy.py:223: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
            mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)
        except Exception as e:
            # shorten the exception chain
>           raise RuntimeError(f"could not compile in {build_dir}:") from e
E           RuntimeError: could not compile in /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0:

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:76: RuntimeError
---------------------------- Captured stdout setup -----------------------------
The Meson build system
Version: 1.7.2
Source dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0/mem_policy
Build dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0/mem_policy/build
Build type: native build
Project name: foo
Project version: undefined

../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
The following exception(s) were encountered:
Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"
Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"

A full log can be found at /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_switch_owner_None_0/mem_policy/build/meson-logs/meson-log.txt
_____________________ ERROR at setup of test_owner_is_base _____________________

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
>           mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:111: in compile_extension_module
    return _c_compile(
        builddir   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0/mem_policy/source.c')
        dirname    = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0/mem_policy')
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        modname    = 'mem_policy'
        name       = 'mem_policy'
        source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:209: in _c_compile
    build(
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
../../python3.13/site-packages/numpy/testing/_private/extbuild.py:243: in build
    subprocess.check_call(["meson", "setup", "--vsenv", ".."],
        build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0/mem_policy/build')
        cfile      = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0/mem_policy/source.c')
        compile_extra = ['-O0', '-g', '-Werror=implicit-function-declaration', '-fPIC']
        fid        = <_io.TextIOWrapper name='/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0/mem_policy/meson.build' mode='wt' encoding='utf-8'>
        include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include', '/usr/include/python3.13']
        includes   = ['-I/usr/lib/python3.13/site-packages/numpy/_core/include', '-I/usr/include/python3.13']
        libraries  = []
        library_dirs = []
        link_dirs  = []
        link_extra = []
        outputfilename = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0/mem_policy/mem_policy.cpython-313-aarch64-linux-gnu.so')
        so_name    = 'mem_policy.cpython-313-aarch64-linux-gnu.so'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['meson', 'setup', '--vsenv', '..'],)
kwargs = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0/mem_policy/build')}
retcode = 1, cmd = ['meson', 'setup', '--vsenv', '..']

    def check_call(*popenargs, **kwargs):
        """Run command with arguments.  Wait for command to complete.  If
        the exit code was zero then return, otherwise raise
        CalledProcessError.  The CalledProcessError object will have the
        return code in the returncode attribute.
    
        The arguments are the same as for the call function.  Example:
    
        check_call(["ls", "-l"])
        """
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           subprocess.CalledProcessError: Command '['meson', 'setup', '--vsenv', '..']' returned non-zero exit status 1.

cmd        = ['meson', 'setup', '--vsenv', '..']
kwargs     = {'cwd': PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0/mem_policy/build')}
popenargs  = (['meson', 'setup', '--vsenv', '..'],)
retcode    = 1

../../python3.13/subprocess.py:421: CalledProcessError

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0')

    @pytest.fixture
    def get_module(tmp_path):
        """ Add a memory policy that returns a false pointer 64 bytes into the
        actual allocation, and fill the prefix with some text. Then check at each
        memory manipulation that the prefix exists, to make sure all alloc/realloc/
        free/calloc go via the functions here.
        """
        if sys.platform.startswith('cygwin'):
            pytest.skip('link fails on cygwin')
        if IS_WASM:
            pytest.skip("Can't build module inside Wasm")
        if IS_EDITABLE:
            pytest.skip("Can't build module for editable install")
    
        functions = [
            ("get_default_policy", "METH_NOARGS", """
                 Py_INCREF(PyDataMem_DefaultHandler);
                 return PyDataMem_DefaultHandler;
             """),
            ("set_secret_data_policy", "METH_NOARGS", """
                 PyObject *secret_data =
                     PyCapsule_New(&secret_data_handler, "mem_handler", NULL);
                 if (secret_data == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(secret_data);
                 Py_DECREF(secret_data);
                 return old;
             """),
            ("set_wrong_capsule_name_data_policy", "METH_NOARGS", """
                 PyObject *wrong_name_capsule =
                     PyCapsule_New(&secret_data_handler, "not_mem_handler", NULL);
                 if (wrong_name_capsule == NULL) {
                     return NULL;
                 }
                 PyObject *old = PyDataMem_SetHandler(wrong_name_capsule);
                 Py_DECREF(wrong_name_capsule);
                 return old;
             """),
            ("set_old_policy", "METH_O", """
                 PyObject *old;
                 if (args != NULL && PyCapsule_CheckExact(args)) {
                     old = PyDataMem_SetHandler(args);
                 }
                 else {
                     old = PyDataMem_SetHandler(NULL);
                 }
                 return old;
             """),
            ("get_array", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                return PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims, NULL,
                                            buf, NPY_ARRAY_WRITEABLE, NULL);
             """),
            ("set_own", "METH_O", """
                if (!PyArray_Check(args)) {
                    PyErr_SetString(PyExc_ValueError,
                                 "need an ndarray");
                    return NULL;
                }
                PyArray_ENABLEFLAGS((PyArrayObject*)args, NPY_ARRAY_OWNDATA);
                // Maybe try this too?
                // PyArray_BASE(PyArrayObject *)args) = NULL;
                Py_RETURN_NONE;
             """),
            ("get_array_with_base", "METH_NOARGS", """
                char *buf = (char *)malloc(20);
                npy_intp dims[1];
                dims[0] = 20;
                PyArray_Descr *descr =  PyArray_DescrNewFromType(NPY_UINT8);
                PyObject *arr = PyArray_NewFromDescr(&PyArray_Type, descr, 1, dims,
                                                     NULL, buf,
                                                     NPY_ARRAY_WRITEABLE, NULL);
                if (arr == NULL) return NULL;
                PyObject *obj = PyCapsule_New(buf, "buf capsule",
                                              (PyCapsule_Destructor)&warn_on_free);
                if (obj == NULL) {
                    Py_DECREF(arr);
                    return NULL;
                }
                if (PyArray_SetBaseObject((PyArrayObject *)arr, obj) < 0) {
                    Py_DECREF(arr);
                    Py_DECREF(obj);
                    return NULL;
                }
                return arr;
    
             """),
        ]
        prologue = '''
            #define NPY_TARGET_VERSION NPY_1_22_API_VERSION
            #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
            #include <numpy/arrayobject.h>
            /*
             * This struct allows the dynamic configuration of the allocator funcs
             * of the `secret_data_allocator`. It is provided here for
             * demonstration purposes, as a valid `ctx` use-case scenario.
             */
            typedef struct {
                void *(*malloc)(size_t);
                void *(*calloc)(size_t, size_t);
                void *(*realloc)(void *, size_t);
                void (*free)(void *);
            } SecretDataAllocatorFuncs;
    
            NPY_NO_EXPORT void *
            shift_alloc(void *ctx, size_t sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->malloc(sz + 64);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld", (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void *
            shift_zero(void *ctx, size_t sz, size_t cnt) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                char *real = (char *)funcs->calloc(sz + 64, cnt);
                if (real == NULL) {
                    return NULL;
                }
                snprintf(real, 64, "originally allocated %ld via zero",
                         (unsigned long)sz);
                return (void *)(real + 64);
            }
            NPY_NO_EXPORT void
            shift_free(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p == NULL) {
                    return ;
                }
                char *real = (char *)p - 64;
                if (strncmp(real, "originally allocated", 20) != 0) {
                    fprintf(stdout, "uh-oh, unmatched shift_free, "
                            "no appropriate prefix\\n");
                    /* Make C runtime crash by calling free on the wrong address */
                    funcs->free((char *)p + 10);
                    /* funcs->free(real); */
                }
                else {
                    npy_uintp i = (npy_uintp)atoi(real +20);
                    if (i != sz) {
                        fprintf(stderr, "uh-oh, unmatched shift_free"
                                "(ptr, %ld) but allocated %ld\\n", sz, i);
                        /* This happens in some places, only print */
                        funcs->free(real);
                    }
                    else {
                        funcs->free(real);
                    }
                }
            }
            NPY_NO_EXPORT void *
            shift_realloc(void *ctx, void * p, npy_uintp sz) {
                SecretDataAllocatorFuncs *funcs = (SecretDataAllocatorFuncs *)ctx;
                if (p != NULL) {
                    char *real = (char *)p - 64;
                    if (strncmp(real, "originally allocated", 20) != 0) {
                        fprintf(stdout, "uh-oh, unmatched shift_realloc\\n");
                        return realloc(p, sz);
                    }
                    return (void *)((char *)funcs->realloc(real, sz + 64) + 64);
                }
                else {
                    char *real = (char *)funcs->realloc(p, sz + 64);
                    if (real == NULL) {
                        return NULL;
                    }
                    snprintf(real, 64, "originally allocated "
                             "%ld  via realloc", (unsigned long)sz);
                    return (void *)(real + 64);
                }
            }
            /* As an example, we use the standard {m|c|re}alloc/free funcs. */
            static SecretDataAllocatorFuncs secret_data_handler_ctx = {
                malloc,
                calloc,
                realloc,
                free
            };
            static PyDataMem_Handler secret_data_handler = {
                "secret_data_allocator",
                1,
                {
                    &secret_data_handler_ctx, /* ctx */
                    shift_alloc,              /* malloc */
                    shift_zero,               /* calloc */
                    shift_realloc,            /* realloc */
                    shift_free                /* free */
                }
            };
            void warn_on_free(void *capsule) {
                PyErr_WarnEx(PyExc_UserWarning, "in warn_on_free", 1);
                void * obj = PyCapsule_GetPointer(capsule,
                                                  PyCapsule_GetName(capsule));
                free(obj);
            };
            '''
        more_init = "import_array();"
        try:
            import mem_policy
            return mem_policy
        except ImportError:
            pass
        # if it does not exist, build and load it
>       return extbuild.build_and_import_extension('mem_policy',
                                                   functions,
                                                   prologue=prologue,
                                                   include_dirs=[np.get_include()],
                                                   build_dir=tmp_path,
                                                   more_init=more_init)

functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
tmp_path   = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0')

../../python3.13/site-packages/numpy/_core/tests/test_mem_policy.py:223: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

modname = 'mem_policy'
functions = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]

    def build_and_import_extension(
            modname, functions, *, prologue="", build_dir=None,
            include_dirs=[], more_init=""):
        """
        Build and imports a c-extension module `modname` from a list of function
        fragments `functions`.
    
    
        Parameters
        ----------
        functions : list of fragments
            Each fragment is a sequence of func_name, calling convention, snippet.
        prologue : string
            Code to precede the rest, usually extra ``#include`` or ``#define``
            macros.
        build_dir : pathlib.Path
            Where to build the module, usually a temporary directory
        include_dirs : list
            Extra directories to find include files when compiling
        more_init : string
            Code to appear in the module PyMODINIT_FUNC
    
        Returns
        -------
        out: module
            The module will have been loaded and is ready for use
    
        Examples
        --------
        >>> functions = [("test_bytes", "METH_O", \"\"\"
            if ( !PyBytesCheck(args)) {
                Py_RETURN_FALSE;
            }
            Py_RETURN_TRUE;
        \"\"\")]
        >>> mod = build_and_import_extension("testme", functions)
        >>> assert not mod.test_bytes('abc')
        >>> assert mod.test_bytes(b'abc')
        """
        body = prologue + _make_methods(functions, modname)
        init = """
        PyObject *mod = PyModule_Create(&moduledef);
        #ifdef Py_GIL_DISABLED
        PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
        #endif
               """
        if not build_dir:
            build_dir = pathlib.Path('.')
        if more_init:
            init += """#define INITERROR return NULL
                    """
            init += more_init
        init += "\nreturn mod;"
        source_string = _make_source(modname, init, body)
        try:
            mod_so = compile_extension_module(
                modname, build_dir, include_dirs, source_string)
        except Exception as e:
            # shorten the exception chain
>           raise RuntimeError(f"could not compile in {build_dir}:") from e
E           RuntimeError: could not compile in /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0:

body       = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...LL,           /* m_doc */\n        -1,             /* m_size */\n        methods,        /* m_methods */\n    };\n    '
build_dir  = PosixPath('/usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0')
functions  = [('get_default_policy', 'METH_NOARGS', '\n             Py_INCREF(PyDataMem_DefaultHandler);\n             return PyDat...ry this too?\n            // PyArray_BASE(PyArrayObject *)args) = NULL;\n            Py_RETURN_NONE;\n         '), ...]
include_dirs = ['/usr/lib/python3.13/site-packages/numpy/_core/include']
init       = '\n    PyObject *mod = PyModule_Create(&moduledef);\n    #ifdef Py_GIL_DISABLED\n    PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;'
modname    = 'mem_policy'
more_init  = 'import_array();'
prologue   = '\n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\...                                            PyCapsule_GetName(capsule));\n            free(obj);\n        };\n        '
source_string = '\n    #include <Python.h>\n\n    \n        #define NPY_TARGET_VERSION NPY_1_22_API_VERSION\n        #define NPY_NO_DE...SED);\n    #endif\n           #define INITERROR return NULL\n                import_array();\nreturn mod;\n    }\n    '

../../python3.13/site-packages/numpy/testing/_private/extbuild.py:76: RuntimeError
---------------------------- Captured stdout setup -----------------------------
The Meson build system
Version: 1.7.2
Source dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0/mem_policy
Build dir: /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0/mem_policy/build
Build type: native build
Project name: foo
Project version: undefined

../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
The following exception(s) were encountered:
Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"
Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"

A full log can be found at /usr/lib/python3-numpy/ptest/tmp/pytest-of-root/pytest-0/test_owner_is_base0/mem_policy/build/meson-logs/meson-log.txt
=========================== short test summary info ============================
ERROR _core/tests/test_array_interface.py::test_cstruct - RuntimeError: could...
ERROR _core/tests/test_mem_policy.py::test_set_policy - RuntimeError: could n...
ERROR _core/tests/test_mem_policy.py::test_default_policy_singleton - Runtime...
ERROR _core/tests/test_mem_policy.py::test_policy_propagation - RuntimeError:...
ERROR _core/tests/test_mem_policy.py::test_context_locality - RuntimeError: c...
ERROR _core/tests/test_mem_policy.py::test_thread_locality - RuntimeError: co...
ERROR _core/tests/test_mem_policy.py::test_switch_owner[0] - RuntimeError: co...
ERROR _core/tests/test_mem_policy.py::test_switch_owner[1] - RuntimeError: co...
ERROR _core/tests/test_mem_policy.py::test_switch_owner[None] - RuntimeError:...
ERROR _core/tests/test_mem_policy.py::test_owner_is_base - RuntimeError: coul...
= 46557 passed, 1385 skipped, 33 xfailed, 5 xpassed, 10 errors in 315.23s (0:05:15) =
DURATION: 319
