From 8e9416051f324f9ca90fdb19ef8cd723cce12fa9 Mon Sep 17 00:00:00 2001 From: Hongxu Jia Date: Fri, 26 Sep 2025 15:47:53 +0800 Subject: [PATCH 1/2] fix reproducibility issue The type of new_value is either `npy_timedelta' or `int64_t' In build/pandas/_libs/tslibs/timedeltas.cpython-313-x86_64-linux-gnu.so.p/pandas/_libs/tslibs/timedeltas.pyx.c .. npy_timedelta __pyx_v_new_value; ... In build/pandas/_libs/tslibs/timedeltas.cpython-313-x86_64-linux-gnu.so.p/pandas/_libs/tslibs/timedeltas.pyx.c ... __pyx_t_5numpy_int64_t __pyx_v_new_value; ... Explicitly define it as int64_t to assure the generated source is reproducibility [1] between builds [1] https://reproducible-builds.org/ Signed-off-by: Hongxu Jia --- pandas/_libs/tslibs/timedeltas.pyx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index c13b0c4cd78a5..bb3b38d728070 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -2068,6 +2068,9 @@ class Timedelta(_Timedelta): disallow_ambiguous_unit(unit) + cdef: + int64_t new_value; + # GH 30543 if pd.Timedelta already passed, return it # check that only value is passed if isinstance(value, _Timedelta): From 55947b0c9185e0a2bd852f886953e69d0faae4af Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:44:45 -0700 Subject: [PATCH 2/2] Update pandas/_libs/tslibs/timedeltas.pyx --- pandas/_libs/tslibs/timedeltas.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index bb3b38d728070..f5efd6922d6d7 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -2069,7 +2069,7 @@ class Timedelta(_Timedelta): disallow_ambiguous_unit(unit) cdef: - int64_t new_value; + int64_t new_value # GH 30543 if pd.Timedelta already passed, return it # check that only value is passed