Avoid sharing default dictionary argument across all instances of class

This commit is contained in:
Alex Stokes 2019-09-24 19:12:04 -07:00
parent c92bade815
commit d0c8b7d8af
No known key found for this signature in database
GPG Key ID: 51CE1721B245C086

View File

@ -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: