Skip to content

Treat negative split limits as unlimited - #502

Closed
rupayon123 wants to merge 1 commit into
mahmoud:masterfrom
rupayon123:contribution/negative-maxsplit-20260916
Closed

rupayon123 wants to merge 1 commit into
mahmoud:masterfrom
rupayon123:contribution/negative-maxsplit-20260916

Conversation

@rupayon123

Copy link
Copy Markdown
Contributor

The change

Negative maxsplit values now leave split/split_iter unlimited, consistent with their documented str.split basis. Previously split_count >= maxsplit immediately disabled splitting, so split([1, None, 2], maxsplit=-1) returned the unsplit input. Zero retains its existing behavior.

Nine new regressions cover negative limits with the default, an iterable, and a callable separator. All nine fail before the fix; the full suite and module doctests pass afterward: 681 passed on Python 3.11.15. No dependencies added.

The backstory

This was found during an explicitly AI-assisted contribution pass focused on Python developer tooling, not while using boltons in a production application. I have not established a history of prior boltons use and do not want to imply one. The useful part of the investigation was comparing unlimited splitting with the existing zero-limit regression and preserving both behaviors.

AI assistance

  • Harness/tooling: OpenAI Codex, acting on behalf of rupayon123.
  • Model: GPT-6-based Codex; exact backend variant is not exposed in the task.
  • Original task excerpt: “Execute my daily GitHub contribution and maintenance workflow on my behalf. Do real, verified work, not only research, a plan, configuration changes, or a status summary.” The task also requires reproducing bugs, avoiding duplicate patches and running relevant tests before upstream submission.

@mahmoud

mahmoud commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Folded into #609 (see the PR description for credit). Thanks for the report and the repro.

@mahmoud mahmoud closed this Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants