Skip to content

fix SpooledStringIO.read(None) raising TypeError - #822

Open
aaronliDev6666 wants to merge 1 commit into
mahmoud:masterfrom
aaronliDev6666:fix-spooledstringio-read-none
Open

aaronliDev6666 wants to merge 1 commit into
mahmoud:masterfrom
aaronliDev6666:fix-spooledstringio-read-none

Conversation

@aaronliDev6666

Copy link
Copy Markdown

fixes #805

SpooledStringIO.read(None) blows up with a TypeError from the codecs reader, which compares the size against 0. StringIO treats an explicit None like read() and reads to EOF, and SpooledBytesIO handles None fine, so the text spool is the odd one out.

this just normalizes None to -1 in SpooledStringIO.read before handing it to the reader. in-memory and rolled-over spools both go through that path.

added test_read_none_size to tests/test_ioutils.py, covering the in-memory and rolled cases. full suite locally: 622 passed, ioutils doctests pass too.

This branch has not been deployed

No deployments
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.

SpooledStringIO.read(None) raises TypeError instead of reading to EOF

1 participant