This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients benjamin.peterson, martin.panter
Date 2016-03-26.22:01:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Socket objects aren’t exactly file-like. Plain non-SSL sockets don’t even have read() methods.

I think giving a meaning to recv(-1) would be an (unwanted) new feature, rather than a bug fix. If you want a file-like object linked to a socket, I would suggest using something like the makefile() method instead of adding to the low-level socket object API.

But to answer your question: no, most file methods treat a negative size as a special request to read until EOF, e.g. read(-1), readline(-1) and readlines(-1) of RawIOBase, BufferedIOBase and TextIOBase. On the other hand, BufferedIOBase.read1(-1) is poorly defined and supported (Issue 23214), but may end up meaning something like “read an arbitrary non-zero chunk with a minimum amount of low-level calls and processing”.
Date User Action Args
2016-03-26 22:01:55martin.pantersetrecipients: + martin.panter, benjamin.peterson
2016-03-26 22:01:55martin.pantersetmessageid: <>
2016-03-26 22:01:55martin.panterlinkissue26644 messages
2016-03-26 22:01:54martin.pantercreate