Skip to content

BUG: segfault with np.isclose  #25327

@saimn

Description

@saimn

Describe the issue:

Hi,
Astropy's devdeps CI job is crashing with a segfault within np.isclose with the last Numpy dev wheel:
https://github.com/astropy/astropy/actions/runs/7112040673/job/19361215616?pr=15686

Fatal Python error: Segmentation fault

Current thread 0x00007fca9a736b80 (most recent call first):
  File "/home/runner/work/astropy/astropy/.tox/py312-test-devdeps/lib/python3.12/site-packages/numpy/_core/numeric.py", line 2357 in isclose
  File "/home/runner/work/astropy/astropy/.tox/py312-test-devdeps/lib/python3.12/site-packages/numpy/_core/numeric.py", line 2255 in allclose
  File "/home/runner/work/astropy/astropy/.tox/py312-test-devdeps/lib/python3.12/site-packages/astropy/io/ascii/tests/common.py", line 44 in assert_almost_equal
  File "/home/runner/work/astropy/astropy/.tox/py312-test-devdeps/lib/python3.12/site-packages/astropy/io/ascii/tests/test_c_reader.py", line 62 in assert_table_equal
  File "/home/runner/work/astropy/astropy/.tox/py312-test-devdeps/lib/python3.12/site-packages/astropy/io/ascii/tests/test_c_reader.py", line 92 in _read
  File "/home/runner/work/astropy/astropy/.tox/py312-test-devdeps/lib/python3.12/site-packages/astropy/io/ascii/tests/test_c_reader.py", line 809 in test_many_rows

I can reproduce locally with the example below.

Reproduce the code example:

Python 3.12.0 (main, Oct  5 2023, 22:42:34) [GCC 13.2.1 20230801] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'2.0.0.dev0+git20231206.82ba4f4'
>>> np.isclose(np.int64(2), np.int64(2), atol=1e-15, rtol=1e-300)
np.True_
>>> for i in range(1000):
...     print(i)
...     _ = np.isclose(np.int64(2), np.int64(2), atol=1e-15, rtol=1e-300)
... 
0
1
2
3
4
...
279
280
281
[1]    501010 segmentation fault (core dumped)  python

Error message:

No response

Python and NumPy Versions:

Python 3.12
Numpy 2.0.0.dev0+git20231206.82ba4f4

Runtime Environment:

No response

Context for the issue:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions