BUG: Segfault constructing pd.Timedelta with numpy 2.3.x/2.4.x on Python 3.14 (pandas 3.0.4)
envgap__pandas-dev__pandas-66083
01 / FAILURE SIGNATURE
As reported upstream
No identifying execution failure has been captured.
Not a benchmark task.
- In a clean container the reported failure did not reproduce, or the known fix did not make the project run.
02 / ENVIRONMENT RECIPE
- Base commit
1a3645d2bdad36b7a4e9f775f15e354b761fcf78- Manifest
pyproject.toml- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
pandas-dev/pandas #66083 · read the original issue
### Pandas version checks
- [x] I have checked that this issue has not already been reported.
- [x] I have confirmed this bug exists on the latest version of pandas (3.0.4).
### Reproducible Example
```python
import pandas as pd
pd.Timedelta(1, unit="D") # interpreter exits with SIGSEGV (signal 11)
```
`import pandas` succeeds; `numpy.timedelta64(1, "D")` succeeds; the **first**
`pd.Timedelta(...)` construction crashes the interpreter. No Python traceback is
produced.
### Issue Description
On Python 3.14, `pandas==3.0.4` segfaults when constructing a `Timedelta` if the
installed numpy is in the 2.3.x–2.4.x range. The crash is a hard SIGSEGV
(exit 139), single-process and fully deterministic.
The numpy `_multiarray_umath` shared object is not stripped, so the faulting
frame symbolizes exactly:
```
#0 PyUFunc_f_f (numpy/_core/_multiarray_umath.cpython-314-x86_64-linux-gnu.so + 0xd5f58)
=> mov (%rdx),%r15 # registers at fault: rdx = 0x6, rcx = 0x0
#1 pandas/_libs/tslibs/timedeltas.cpython-314-x86_64-linux-gnu.so
#2 pandas/_libs/tslibs/timedeltas.cpython-314-x86_64-linux-gnu.so
#3 slot_tp_new -> type_call -> _PyObject_MakeTpCall # Timedelta(1, unit='D')
```
`PyUFunc_f_f` is numpy's generic float32 unary ufunc inner loop, whose signature
is `(char **args, npy_intp *dimensions, npy_intp *steps, void *func)`. At the
fault, `rdx` (the `steps` pointer) holds `0x6` and `rcx` (`func`) is `NULL`; the
loop dereferences `steps` and segfaults.
I bisected across numpy/pandas versions, each in a clean venv (Python 3.14.5),
running only the one-liner above:
| numpy | pandas | result |
|--------|--------|---------|
| 2.3.5 | 3.0.3 | OK |
| 2.3.5 | 3.0.4 | SIGSEGV |
| 2.4.6 | 3.0.4 | SIGSEGV |
| 2.5.0 | 3.0.4 | OK |
Observations (reporting only, not asserting a cause):
- pandas 3.0.3 and 3.0.4 both declare `numpy>=2.3.3; python_version >= "3.14"`.
3.0.3 runs fine on numpy 2.3.5; 3.0.4 segfaults on the same numpy.
- 3.0.4 runs fine on numpy 2.5.0 but segfaults on numpy 2.3.5 and 2.4.6.
- Reproduced on three different x86-64 CPUs/hosts (one with AVX2, one without)
and inside a `python3.14` Debian-bookworm container — so it does not appear to
be CPU- or host-specific.
### Expected Behavior
`pd.Timedelta(1, unit="D")` returns a `Timedelta` (or raises a Python exception)
rather than segfaulting, for any numpy version permitted by pandas's declared
dependency metadata.
### Installed Versions
<details>
```
python : 3.14.5 (x86_64, glibc 2.42)
pandas : 3.0.4 (manylinux x86_64 wheel, PyPI)
numpy : 2.3.5 (manylinux x86_64 wheel, PyPI)
OS : Linux 7.0.12 (Fedora 43); also reproduced on Debian bookworm container
install: clean venv -> `pip install numpy==2.3.5 pandas==3.0.4`
```
</details>
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]