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 Rotkraut, demian.brecht, harobed, martin.panter, matrixise, orsenthil, petri.lehtinen, piotr.dobrogost, pitrou, vstinner, whitemice
Date 2016-08-11.03:14:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
_is_textIO(): I’m sorry but I still prefer the TextIOBase check over read(0). Each option has a disadvantage, but with TextIOBase, the disadvantage only affects text files, not byte files.

Maybe another option is to stick with the current checking of the “mode” attribute, or are its failings significant for chunked encoding? It seems to me that the most important use cases would be reading bytes from a pipe file, custom bytes file object reader, generator, etc, but not a text file without a “mode” attribute.

Checking Content-Length and Transfer-Encoding: I would prefer to remove this, unless there is a “good” reason to keep them. I want to understand why the three specific checks were added, and what made them more special than other potential checks (e.g. the format of the Content-Length value, or that the resulting body matches it). If the reason is something like “it is too easy for the caller to accidentally trigger the problem”, then there may be another way to fix it. Or maybe it is a mitigation for a security problem? But at the moment, it just seems to me like code being too smart for its own good.

I mentioned a few possible bugs with parsing Transfer-Encoding at <>. The format of the Transfer-Encoding value is specified at <> and <>. In Issue 23498, I identified some parts of Python that parse header values like this, although it looks like http.cookiejar.split_header_words() may be the only one usable for Transfer-Encoding.
Date User Action Args
2016-08-11 03:14:50martin.pantersetrecipients: + martin.panter, orsenthil, pitrou, vstinner, harobed, petri.lehtinen, piotr.dobrogost, demian.brecht, matrixise, whitemice, Rotkraut
2016-08-11 03:14:50martin.pantersetmessageid: <>
2016-08-11 03:14:50martin.panterlinkissue12319 messages
2016-08-11 03:14:49martin.pantercreate