Skip to content

Conversation

jorisvandenbossche
Copy link
Member

@jorisvandenbossche jorisvandenbossche commented Sep 4, 2025

Addresses the regression part of #62240, does not yet fix the inconsistencies entirely

@jorisvandenbossche jorisvandenbossche added this to the 2.3.3 milestone Sep 4, 2025
@jorisvandenbossche jorisvandenbossche added Regression Functionality that used to work in a prior pandas version Strings String extension data type and string data labels Sep 4, 2025
# GH#61952
pat = pat.pattern
if isinstance(pat, str) and not pat.startswith("^"):
if not pat.startswith("^"):
Copy link
Member Author

@jorisvandenbossche jorisvandenbossche Sep 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This essentially reverts this back to what we had before 2.3.2. This means it won't support compiled regex, but that seems better than only supporting it half-baked (and this is only for ArrowExtensionArray, the ArrowStringArray will fall back). Longer term we should decide on the exact behaviour we want in #62240 and ensure all possible variants behave the same (including ArrowDtype)

But I could also leave it as is (the default string dtype should never get here, as pat being a compiled regex is handled before getting here)

@mroeschke mroeschke merged commit 2891172 into pandas-dev:main Sep 5, 2025
38 checks passed
Copy link

lumberbot-app bot commented Sep 5, 2025

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout 2.3.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 2891172d2004f029e948d92031def8aa4c29be36
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #62251: REGR: fix string contains/match methods with compiled regex with flags'
  1. Push to a named branch:
git push YOURFORK 2.3.x:auto-backport-of-pr-62251-on-2.3.x
  1. Create a PR against branch 2.3.x, I would have named this PR:

"Backport PR #62251 on branch 2.3.x (REGR: fix string contains/match methods with compiled regex with flags)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@mroeschke
Copy link
Member

Thanks @jorisvandenbossche

@jorisvandenbossche
Copy link
Member Author

Manual backport -> #62265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Regression Functionality that used to work in a prior pandas version Strings String extension data type and string data

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants