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.
This commit is contained in:
Thomas Kriechbaumer 2015-05-27 17:31:18 +02:00
parent 5288aa3640
commit 754f929187

View File

@ -245,8 +245,12 @@ class SettingsFrame(Frame):
SETTINGS_MAX_HEADER_LIST_SIZE=0x6, 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) super(SettingsFrame, self).__init__(length, flags, stream_id)
if settings is None:
settings = {}
self.settings = settings self.settings = settings
@classmethod @classmethod