Skip to content

BUG: Inplace builds (more?) do not install their __init__.pxd well enough #25135

@mgorny

Description

@mgorny

Describe the issue:

The 1.26.2 introduced a new test failure:

FAILED numpy/core/tests/test_cython.py::test_conv_intp - TypeError: 'float' object cannot be interpreted as an integer

Full log below. I've used maintenance/1.26.x branch as of 4962e22 (which is equivalent to 1.26.2, except for the version number).

Reproduce the code example:

git clone https://github.com/numpy/numpy --recurse-submodules -b maintenance/1.26.x --depth 10
cd numpy
python3.11 -m venv .venv
. .venv/bin/activate
pip install -e . -r test_requirements.txt
cp ./build/cp311/numpy/core/*.h numpy/core/include/numpy/
python -m pytest numpy/core/tests/test_cython.py::test_conv_intp

Error message:

========================================================= test session starts =========================================================
platform linux -- Python 3.11.6, pytest-7.4.0, pluggy-1.3.0
rootdir: /tmp/numpy
configfile: pytest.ini
plugins: hypothesis-6.81.1, xdist-3.4.0, cov-4.1.0
collected 1 item                                                                                                                      

numpy/core/tests/test_cython.py F                                                                                               [100%]

============================================================== FAILURES ===============================================================
___________________________________________________________ test_conv_intp ____________________________________________________________

install_temp = None

    def test_conv_intp(install_temp):
        import checks
    
        class myint:
            def __int__(self):
                return 3
    
        # These conversion passes via `__int__`, not `__index__`:
>       assert checks.conv_intp(3.) == 3

checks     = <module 'checks' from '/tmp/pytest-of-mgorny/pytest-5/test_conv_intp0/build/checks.cpython-311-x86_64-linux-gnu.so'>
install_temp = None
myint      = <class 'numpy.core.tests.test_cython.test_conv_intp.<locals>.myint'>

numpy/core/tests/test_cython.py:134: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   ???
E   TypeError: 'float' object cannot be interpreted as an integer


checks.pyx:34: TypeError
-------------------------------------------------------- Captured stdout setup --------------------------------------------------------
1.2.3
The Meson build system
Version: 1.2.3
Source dir: /tmp/numpy/numpy/core/tests/examples/cython
Build dir: /tmp/pytest-of-mgorny/pytest-5/test_conv_intp0/build
Build type: native build
Project name: checks
Project version: undefined
C compiler for the host machine: ccache cc (gcc 13.2.1 "cc (Gentoo 13.2.1_p20231014 p8) 13.2.1 20231014")
C linker for the host machine: cc ld.bfd 2.41
Cython compiler for the host machine: cython (cython 3.0.5)
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program python3 found: YES (/tmp/numpy/.venv/bin/python3.11)
Found pkg-config: /usr/bin/pkg-config (2.0.3)
Run-time dependency python found: YES 3.11
Build targets in project: 1

Found ninja-1.11.1 at /usr/bin/ninja
[1/3] cython -M --fast-fail -3 /tmp/numpy/numpy/core/tests/examples/cython/checks.pyx -o checks.cpython-311-x86_64-linux-gnu.so.p/checks.pyx.c
[2/3] ccache cc -Ichecks.cpython-311-x86_64-linux-gnu.so.p -I. -I../../../../numpy/numpy/core/tests/examples/cython -I/tmp/numpy/numpy/core/include -I/usr/include/python3.11 -fvisibility=hidden -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -w -O0 -g -fPIC -DNPY_NO_DEPRECATED_API=0 -DNPY_TARGET_VERSION=NPY_2_0_API_VERSION -MD -MQ checks.cpython-311-x86_64-linux-gnu.so.p/meson-generated_checks.pyx.c.o -MF checks.cpython-311-x86_64-linux-gnu.so.p/meson-generated_checks.pyx.c.o.d -o checks.cpython-311-x86_64-linux-gnu.so.p/meson-generated_checks.pyx.c.o -c checks.cpython-311-x86_64-linux-gnu.so.p/checks.pyx.c
[3/3] cc  -o checks.cpython-311-x86_64-linux-gnu.so checks.cpython-311-x86_64-linux-gnu.so.p/meson-generated_checks.pyx.c.o -Wl,--as-needed -Wl,--allow-shlib-undefined -shared -fPIC
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/bin/ninja -v
======================================================= short test summary info =======================================================
FAILED numpy/core/tests/test_cython.py::test_conv_intp - TypeError: 'float' object cannot be interpreted as an integer
========================================================== 1 failed in 8.36s ==========================================================

Runtime information:

1.26.3
3.11.6 (main, Oct 26 2023, 14:30:39) [GCC 13.2.1 20231014]
WARNING: `threadpoolctl` not found in system! Install it by `pip install threadpoolctl`. Once installed, try `np.show_runtime` again for more detailed build information
[{'numpy_version': '1.26.3',
  'python': '3.11.6 (main, Oct 26 2023, 14:30:39) [GCC 13.2.1 20231014]',
  'uname': uname_result(system='Linux', node='pomiot', release='6.6.1-gentoo-dist', version='#1 SMP PREEMPT_DYNAMIC Fri Nov 10 16:04:08 -00 2023', machine='x86_64')},
 {'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
                      'found': ['SSSE3',
                                'SSE41',
                                'POPCNT',
                                'SSE42',
                                'AVX',
                                'F16C',
                                'FMA3',
                                'AVX2'],
                      'not_found': ['AVX512F',
                                    'AVX512CD',
                                    'AVX512_KNL',
                                    'AVX512_KNM',
                                    'AVX512_SKX',
                                    'AVX512_CLX',
                                    'AVX512_CNL',
                                    'AVX512_ICL',
                                    'AVX512_SPR']}}]
None

Context for the issue:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions