◐ Shell
clean mode source ↗

Message 240611 - Python tracker

Another issue should be addressed by patch...

When trying to guess the content-length, here is the code you find...

        try:
            thelen = str(len(body))
        except TypeError as te:
            [...]

The call to `len` will raise a `TypeError` in case of a C file "object". But if body is a python file-like object, it will often raise an `AttributeError`.

So, the code should be replaced by (in both python 2.7 and 3):

        try:
            thelen = str(len(body))
        except (TypeError, AttributeError):
            [...]