Skip to content

sdk/python: validate buffering and errors before opening files - #7898

Merged
jiefenghuang merged 3 commits into
juicedata:mainfrom
adenzhou1350:codex/python-open-buffering-validation
Nov 24, 2026
Merged

jiefenghuang merged 3 commits into
juicedata:mainfrom
adenzhou1350:codex/python-open-buffering-validation

Conversation

@adenzhou1350

@adenzhou1350 adenzhou1350 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Invalid options can alter a file before Client.open() reports an error: "wb", buffering=None and "w", errors=1 both truncate existing data before raising TypeError. Creating modes can also leave an unwanted file behind. Python's standard open() rejects these types before touching the file.

Change

Validate integer buffering and string-or-None errors before native I/O. Integer-protocol objects remain supported. Previously accepted float buffer sizes and falsy non-string error handlers now raise TypeError. Update regressions and both SDK guides.

Validation

22 selected project SDK tests pass locally on Linux (open, readinto, seek and truncate). The errors-option regressions fail in 20 subcases on the earlier buffering-only PR head, then pass with this addition. Normal integer buffering and text error handlers are covered.

The native comparison used Python 3.12, task-private SQLite fixtures and a reused libjfs build. Full backend CI and a fresh native rebuild were not run locally. Applicable pinned whitespace hooks pass.

Official CI passes on ec7ae7d22: all 29 checks are green; the MySQL, Redis and TiKV Python SDK jobs each pass 83 tests.

AI-assisted source audit, patch and tests; validation executed as described above.

@adenzhou1350 adenzhou1350 changed the title sdk/python: validate buffering before opening files sdk/python: validate buffering and errors before opening files Nov 20, 2026
@zxh326 zxh326 self-assigned this Nov 23, 2026

@zxh326 zxh326 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jiefenghuang
jiefenghuang merged commit 18dd033 into juicedata:main Nov 24, 2026
29 checks passed
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.

4 participants