diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2009-03-26 22:04:05 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2009-03-26 22:04:05 (GMT) |
commit | ef9f48e578a14c91fb101a4fbe73e5c3d400dcbf (patch) | |
tree | 17880f236ca3a769d272716c60329a06e2784f16 | |
parent | 5f28b7b7978ad96fef83e2b41017bdd7ab8a082f (diff) | |
download | cpython-ef9f48e578a14c91fb101a4fbe73e5c3d400dcbf.zip cpython-ef9f48e578a14c91fb101a4fbe73e5c3d400dcbf.tar.gz cpython-ef9f48e578a14c91fb101a4fbe73e5c3d400dcbf.tar.bz2 |
Simplify complex expression.
-rw-r--r-- | Lib/http/client.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py index b1b76c2..0477ddd 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -906,7 +906,9 @@ class HTTPConnection: self._set_content_length(body) for hdr, value in headers.items(): self.putheader(hdr, value) - self.endheaders(body.encode('ascii') if isinstance(body, str) else body) + if isinstance(body, str): + body = body.encode('ascii') + self.endheaders(body) def getresponse(self): """Get the response from the server.""" |