GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — py: fix explicit string split limits and empty separators by ac1982 · Pull Request #262 · go-python/gpython

Conversation

@ac1982

@ac1982 ac1982 commented Oct 12, 2026

Copy link
Copy Markdown

'a,b,c'.split(',', -1) currently returns [], while omitting maxsplit returns all three fields. An empty separator also succeeds instead of raising ValueError.

Translate negative maxsplit values to Go's unlimited SplitN form, use the Python default of -1, and reject empty separators before splitting. Bound the conversion for large positive limits. Adds direct Go regression cases and interpreter-level Python assertions; seven direct cases fail on the original code.

Validation on Linux/arm64:

  • Full go test -tags=ci -race ./... with Go 1.27.1 passes, including Python test scripts.
  • Full GOTOOLCHAIN=go1.19.13 go test -tags=ci ./... passes.
  • goimports and diff whitespace checks pass.
  • Standalone vet and Staticcheck 2026.2.1 report existing diagnostics (unkeyed literals/unreachable code and an unused assignment); their output is identical on clean upstream 444ae5e. Historical Staticcheck 2022.1 and other OS/architecture jobs were not run.

Contributor registration is pending in go-python/license#24. AI-assisted implementation and validation.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ac1982
py: fix explicit string split limits and empty separators
fa1e212
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@ac1982
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.