Patchwork [3,of,8,V2] hgweb: don't use mutable default argument value

login
register
mail settings
Submitter Gregory Szorc
Date March 13, 2017, 4:57 a.m.
Message ID <735405d42d45801c7b75.1489381055@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/19270/
State Accepted
Headers show

Comments

Gregory Szorc - March 13, 2017, 4:57 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1482796547 25200
#      Mon Dec 26 16:55:47 2016 -0700
# Node ID 735405d42d45801c7b75448e0263088327cac4af
# Parent  f3927785d168824ac04c4eb44361337775286e01
hgweb: don't use mutable default argument value

Patch

diff --git a/mercurial/hgweb/common.py b/mercurial/hgweb/common.py
--- a/mercurial/hgweb/common.py
+++ b/mercurial/hgweb/common.py
@@ -91,12 +91,12 @@  permhooks = [checkauthz]
 
 
 class ErrorResponse(Exception):
-    def __init__(self, code, message=None, headers=[]):
+    def __init__(self, code, message=None, headers=None):
         if message is None:
             message = _statusmessage(code)
         Exception.__init__(self, message)
         self.code = code
-        self.headers = headers
+        self.headers = headers or []
 
 class continuereader(object):
     def __init__(self, f, write):