removesuffix helper returns an empty string for an empty suffix
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Start at src/browserbase/_utils/_utils.py:368-375 and inspect the removesuffix implementation alongside the related prefix helper. Run the existing test suite, then add coverage for empty-string prefix and suffix cases; done means removesuffix("abc", "") returns "abc" and matches the standard-library behavior.
Written by the indexing model from the issue text.
Description
Description
The internal removesuffix helper claims to backport str.removesuffix, but it returns an empty string when the requested suffix is empty.
Code reference
src/browserbase/_utils/_utils.py:368-375
The implementation executes string[:-len(suffix)]; for an empty suffix this becomes string[:-0], which is string[:0].
Reproduction
from browserbase._utils._utils import removesuffix
print(repr(removesuffix("abc", "")))
print(repr("abc".removesuffix("")))
Actual:
''
'abc'
Expected behavior
To match the documented stdlib behavior, an empty suffix should leave the original string unchanged.
Why it matters
This shared helper silently corrupts input for a valid edge case and has no direct test coverage. Even though current in-repo call sites are limited, it is exported through browserbase._utils and may be reused by generated or manual code later. The fix is small (if suffix and string.endswith(suffix): ...) and should include empty-string tests for both prefix/suffix helpers.
- Dominant language
- Python
- Stars
- 93
- Forks
- 16
- Avg merge
- 11m
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from browserbase/sdk-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
browserbase/sdk-python#180 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
browserbase/sdk-python#179 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
browserbase/sdk-python#178 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
browserbase/sdk-python#176 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
browserbase/sdk-python#175 ·
All issues in browserbase/sdk-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100