Skip to content

fix: defer pd.to_datetime() in test parametrize to avoid nightly segfault#11407

Open
C1-BA-B1-F3 wants to merge 1 commit into
pydata:mainfrom
C1-BA-B1-F3:fix-nightly-ci-pd-to-datetime-segfault
Open

fix: defer pd.to_datetime() in test parametrize to avoid nightly segfault#11407
C1-BA-B1-F3 wants to merge 1 commit into
pydata:mainfrom
C1-BA-B1-F3:fix-nightly-ci-pd-to-datetime-segfault

Conversation

@C1-BA-B1-F3

Copy link
Copy Markdown

Fixes #11402

Problem

Nightly upstream-dev CI is failing with a segfault in pandas when pd.to_datetime() is called at module level (inside @pytest.mark.parametrize decorator arguments). The segfault occurs during test collection, crashing all xdist workers.

The root cause is pd.to_datetime() being called with unit="ns" at import time in test_coding_times.py, which triggers a pandas bug in the nightly build.

Fix

Move the pd.to_datetime() calls from the module-level @pytest.mark.parametrize into the test function body. Instead of passing pre-constructed datetime arrays as parameters, pass raw string lists and construct the datetime objects inside the test.

This is a minimal, surgical fix that:

  • Avoids the pandas segfault by deferring datetime construction to test runtime
  • Preserves the exact same test logic and assertions
  • All 307 tests pass, 854 skipped, 1 xfailed

…y segfault

Move pd.to_datetime() calls from module-level @pytest.mark.parametrize
into the test function body. This avoids a segfault in pandas nightly
caused by constructing datetime objects at module import time.

Fixes pydata#11402
@dcherian dcherian added the run-upstream Run upstream CI label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-upstream Run upstream CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

⚠️ Nightly upstream-dev CI failed ⚠️

2 participants