Commit c64ef05
authored
BUG: fix empty suffix and prefix handling in pyarrow string methods
Python's `str.removeprefix("")` and `str.removesuffix("")` return the
original string.
The current pyarrow-backed implementation slices with `stop=0` or
`start=0` when the prefix or suffix is empty, which can result in
unexpected behavior instead of preserving the original values.
This PR adds explicit guards for empty prefix and suffix inputs and
includes tests to ensure parity with Python semantics.1 parent 7b51d3a commit c64ef05
1 file changed
+3
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
215 | 217 | | |
216 | 218 | | |
| 219 | + | |
217 | 220 | | |
218 | 221 | | |
219 | 222 | | |
| |||
0 commit comments