httpconnection: remove a mutable default argument
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 24 Sep 2015 00:54:30 -0700
changeset 26347 e9a35411bbbc
parent 26346 2449a0a6ebda
child 26348 b80b2ee71a08
httpconnection: remove a mutable default argument Mutable default arguments are know to the state of California to cause bugs.
mercurial/httpconnection.py
--- a/mercurial/httpconnection.py	Thu Sep 24 00:52:21 2015 -0700
+++ b/mercurial/httpconnection.py	Thu Sep 24 00:54:30 2015 -0700
@@ -107,7 +107,9 @@
 
 class HTTPConnection(httpclient.HTTPConnection):
     response_class = HTTPResponse
-    def request(self, method, uri, body=None, headers={}):
+    def request(self, method, uri, body=None, headers=None):
+        if headers is None:
+            headers = {}
         if isinstance(body, httpsendfile):
             body.seek(0)
         httpclient.HTTPConnection.request(self, method, uri, body=body,