[PATCH 5 of 7] httpclient: don't use mutable default argument value

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Mar 15 03:01:17 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1489560565 25200
#      Tue Mar 14 23:49:25 2017 -0700
# Node ID 855f0045de7f94630923be4639f234b28be89e7f
# Parent  92e6b5422e92f0ad7707289335d9d40fb7c7da98
# EXP-Topic check-pylint
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 855f0045de7f
httpclient: don't use mutable default argument value

Caught by pylint.

diff --git a/mercurial/httpclient/__init__.py b/mercurial/httpclient/__init__.py
--- a/mercurial/httpclient/__init__.py
+++ b/mercurial/httpclient/__init__.py
@@ -631,7 +631,7 @@ class HTTPConnection(object):
         self.close()
         self._connect(pheaders)
 
-    def request(self, method, path, body=None, headers={},
+    def request(self, method, path, body=None, headers=None,
                 expect_continue=False):
         """Send a request to the server.
 
@@ -642,6 +642,8 @@ class HTTPConnection(object):
         available. Use the `getresponse()` method to retrieve the
         response.
         """
+        if headers is None:
+            headers = {}
         method = _ensurebytes(method)
         path = _ensurebytes(path)
         if self.busy():


More information about the Mercurial-devel mailing list