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 Rotkraut
Recipients Rotkraut, demian.brecht, harobed, martin.panter, orsenthil, petri.lehtinen, piotr.dobrogost, pitrou, whitemice
Date 2016-08-02.11:36:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1470137818.79.0.45623449666.issue12319@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for your review!  Here comes a new version of the patch.  I believe I addressed all review comments.

Since I didn't get any feedback on my questions raised above, I resolved them as follows:

1. I dropped the EncodingError exception introduced by an earlier version of the patch by Damien.  This error is raised when the caller sets an illegal combination of headers.  Since the error does not occur as a result of talking to the HTTP server, I think an HTTPException or a child thereof is just wrong.  A ValueError is more appropriate here and that is what the code raises now.

2. I changed the test whether a file-like is a text stream to isText = isinstance(readable.read(0), str).  This relies only on the read() method and is the most generic test.  The original code would fail for StringIO and other text streams that do not have the mode attribute.  Note that I needed to fix a test that violated the file object protocol with a read() method that ignored the size parameter.
History
Date User Action Args
2016-08-02 11:36:59Rotkrautsetrecipients: + Rotkraut, orsenthil, pitrou, harobed, petri.lehtinen, martin.panter, piotr.dobrogost, demian.brecht, whitemice
2016-08-02 11:36:58Rotkrautsetmessageid: <1470137818.79.0.45623449666.issue12319@psf.upfronthosting.co.za>
2016-08-02 11:36:58Rotkrautlinkissue12319 messages
2016-08-02 11:36:57Rotkrautcreate