Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: too many arguments dropped when passing to base comm constructor #1051

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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