Skip to content

Conversation

@wtn
Copy link
Contributor

@wtn wtn commented Dec 4, 2025

Fixes #22591.

Series.replace() and Series.replace_strict() panic when old or new is a list containing Expr objects.

Add validation in Expr.replace() and Expr.replace_strict() to raise TypeError for this case.

@github-actions github-actions bot added fix Bug fix python Related to Python Polars labels Dec 4, 2025
@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.63%. Comparing base (b7c28d8) to head (c7d8574).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #25612      +/-   ##
==========================================
- Coverage   79.67%   79.63%   -0.05%     
==========================================
  Files        1743     1743              
  Lines      240288   240302      +14     
  Branches     3038     3044       +6     
==========================================
- Hits       191442   191356      -86     
- Misses      48063    48163     +100     
  Partials      783      783              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mcrumiller
Copy link
Contributor

Could we instead convert a replace into a when/then sequence if we encounter expressions in the replacement?

@wtn wtn force-pushed the replace branch 2 times, most recently from 8008edd to e06124a Compare December 5, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix python Related to Python Polars

Projects

None yet

Development

Successfully merging this pull request may close these issues.

replace with invalid args PanicException

2 participants