Skip to content

docs(ioutils): use text streams in the StringIO example - #555

Closed
xiehuanyi wants to merge 1 commit into
mahmoud:masterfrom
xiehuanyi:docs/spooled-text-examples
Closed

xiehuanyi wants to merge 1 commit into
mahmoud:masterfrom
xiehuanyi:docs/spooled-text-examples

Conversation

@xiehuanyi

Copy link
Copy Markdown

The change

The I/O guide sends a text string to SpooledBytesIO, which raises TypeError: memoryview: a bytes-like object is required, not 'str'. Use SpooledStringIO for the io.StringIO replacement and explain the text/binary distinction. Remove Python-2-only cStringIO claims and the claim that a binary standard-library spooled file cannot be opened as a ZIP.

Validation: ran the original failing text write; verified the corrected text examples and rollover; opened an in-memory ZIP through both binary spooled implementations. uv run pytest --doctest-modules boltons tests -q: 678 passed, with 12 subtests passed. Runtime code is unchanged.

The backstory

I asked Codex to check existing issues and documentation against repository behavior. The text-stream example failed during that review, so this contribution corrects the guide with direct checks of the documented operations.

AI assistance

  • Harness/tooling: Codex
  • Model(s): OpenAI GPT-6; the exact deployment identifier is not exposed in this session.
  • Original prompt excerpt: “选择pr的要求是直接解决issue或者repo文档错误,issue的要求是简单,可以十分钟之内做完,验证。……做之前看看repo的pr的要求,不要ai的pr就不要提交哈。”

Copilot AI balanced review requested due to automatic review settings October 7, 2026 10:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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.

3 participants