diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-05-27 17:31:18 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-05-29 11:42:46 +0200 |
commit | 754f929187e3954eb05971e38bcd3358d3a5e3be (patch) | |
tree | fc3506ebf0e09a517bcf9296e0cbc4abffb42479 /netlib/h2/frame.py | |
parent | 5288aa36403bc4b350700a0bf97adc4413f2a398 (diff) | |
download | mitmproxy-754f929187e3954eb05971e38bcd3358d3a5e3be.tar.gz mitmproxy-754f929187e3954eb05971e38bcd3358d3a5e3be.tar.bz2 mitmproxy-754f929187e3954eb05971e38bcd3358d3a5e3be.zip |
fix default argument
Python evaluates default args during method definition.
So you get the same dict each time you call this method.
Therefore the dict is the SAME actual object each time.
Diffstat (limited to 'netlib/h2/frame.py')
-rw-r--r-- | netlib/h2/frame.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/netlib/h2/frame.py b/netlib/h2/frame.py index 51de7d4d..ed6af200 100644 --- a/netlib/h2/frame.py +++ b/netlib/h2/frame.py @@ -245,8 +245,12 @@ class SettingsFrame(Frame): SETTINGS_MAX_HEADER_LIST_SIZE=0x6, ) - def __init__(self, length=0, flags=Frame.FLAG_NO_FLAGS, stream_id=0x0, settings={}): + def __init__(self, length=0, flags=Frame.FLAG_NO_FLAGS, stream_id=0x0, settings=None): super(SettingsFrame, self).__init__(length, flags, stream_id) + + if settings is None: + settings = {} + self.settings = settings @classmethod |