From ae1db6e3ab7a616bd9bd2765d8932081e87bbff6 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Mon, 16 Dec 2019 21:36:24 +0800 Subject: [PATCH] mutable varibale bug --- mswp.py | 4 +++- plugins/net.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mswp.py b/mswp.py index 31e627f..4396a6a 100644 --- a/mswp.py +++ b/mswp.py @@ -1,5 +1,7 @@ class Datapack: - def __init__(self, method='post', app='all', version='msw/1.0', head={}, body=b'', check_head=True): + def __init__(self, method='post', app='all', version='msw/1.0', head=None, body=b'', check_head=True): + if head is None: + self.head = {} self.method = method self.app = app self.version = version diff --git a/plugins/net.py b/plugins/net.py index d924ff4..6bb5161 100644 --- a/plugins/net.py +++ b/plugins/net.py @@ -81,7 +81,7 @@ class Netrecv: while True: # try unpack # - dp = copy.copy(Datapack(check_head=False)) + dp = Datapack(check_head=False) dp.encode_data = data print('data', data) try: