Skip to content

Commit

Permalink
fix: too many arguments dropped when passing to base comm constructor (
Browse files Browse the repository at this point in the history
…#1051)

Co-authored-by: martinRenou <martin.renou@gmail.com>
Closes #1050
  • Loading branch information
maartenbreddels authored Dec 8, 2022
1 parent b13c46a commit 5e1b155
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions ipykernel/comm/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ def _default_comm_id(self):
def __init__(self, *args, **kwargs):
# Comm takes positional arguments, LoggingConfigurable does not, so we explicitly forward arguments
traitlets.config.LoggingConfigurable.__init__(self, **kwargs)
for name in self.trait_names():
if name in kwargs:
kwargs.pop(name)
# drop arguments not in BaseComm
kwargs.pop("kernel", None)
BaseComm.__init__(self, *args, **kwargs)


Expand Down
3 changes: 2 additions & 1 deletion ipykernel/tests/test_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def test_comm(kernel):
manager = CommManager(kernel=kernel)
kernel.comm_manager = manager

c = Comm(kernel=kernel)
c = Comm(kernel=kernel, target_name="bar")
msgs = []

def on_close(msg):
Expand All @@ -23,6 +23,7 @@ def on_message(msg):
c.handle_close({})
c.close()
assert len(msgs) == 2
assert c.target_name == "bar"


def test_comm_manager(kernel):
Expand Down

0 comments on commit 5e1b155

Please sign in to comment.