From d0c8b7d8af02490c7eab293bed27ebb1da397dbc Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 24 Sep 2019 19:12:04 -0700 Subject: [PATCH] Avoid sharing default dictionary argument across all instances of class --- libp2p/protocol_muxer/multiselect.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libp2p/protocol_muxer/multiselect.py b/libp2p/protocol_muxer/multiselect.py index 72279c6..06e268a 100644 --- a/libp2p/protocol_muxer/multiselect.py +++ b/libp2p/protocol_muxer/multiselect.py @@ -19,7 +19,11 @@ class Multiselect(IMultiselectMuxer): handlers: Dict[TProtocol, StreamHandlerFn] - def __init__(self, default_handlers: Dict[TProtocol, StreamHandlerFn] = {}) -> None: + def __init__( + self, default_handlers: Dict[TProtocol, StreamHandlerFn] = None + ) -> None: + if not default_handlers: + default_handlers = {} self.handlers = default_handlers def add_handler(self, protocol: TProtocol, handler: StreamHandlerFn) -> None: