fix: defer pd.to_datetime() in test parametrize to avoid nightly segfault#11407
Open
C1-BA-B1-F3 wants to merge 1 commit into
Open
fix: defer pd.to_datetime() in test parametrize to avoid nightly segfault#11407C1-BA-B1-F3 wants to merge 1 commit into
C1-BA-B1-F3 wants to merge 1 commit into
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.parametrizedecorator arguments). The segfault occurs during test collection, crashing all xdist workers.The root cause is
pd.to_datetime()being called withunit="ns"at import time intest_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.parametrizeinto 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: