Demian Brecht added the comment:

> The logic now is as it was before, except that we set a content length of 
> zero if the body is None and the method is one of OPTIONS, PATCH, PUT, or 
> POST.

I see we definitely have similar thinking on the modifications required for 
this, but I don’t think I’m in favour of the approach in the patch. Consider 
the case where you have a GET request without a body. Now, instead of simply 
circumventing the _set_content_length method altogether as would have been done 
previously, the code path will now go into _set_content_length, have a 
TypeError exception raised on (str(len([None])) and then an AttributeError 
exception raised on os.fstat([None].fileno()). That seems to be quite a bit of 
additional overhead when it could be avoided altogether by an earlier check as 
I have in my example.

What do you think?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23539>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to