]> granicus.if.org Git - python/commitdiff
Simplify complex expression.
authorJeremy Hylton <jeremy@alum.mit.edu>
Thu, 26 Mar 2009 22:04:05 +0000 (22:04 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Thu, 26 Mar 2009 22:04:05 +0000 (22:04 +0000)
Lib/http/client.py

index b1b76c283b46a214efccd4fe8f4c0e01fc2d5f53..0477ddd2d1b13dfcc082ccb7abb5a0f5265124e0 100644 (file)
@@ -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."""