Repository: ipython/ipykernel

Issue:
Latest version break IPyWidgets
IPyKernel Version: 6.19.0
Install Jupyter and ipywidgets 
Run a notebook with the following code

```python
import ipywidgets as widgets
widgets.IntSlider()
```

Slider is not renderered
Here is the error message
```
A Jupyter widget could not be displayed because the widget state could not be found. 
This could happen if the kernel storing the widget is no longer available, or if the widget state was not saved in the notebook. 
You may be able to create the widget by running the appropriate cells.
```

Discussion:

Patch:
diff --git a/ipykernel/comm/comm.py b/ipykernel/comm/comm.py
index c06d233..295232e 100644
--- a/ipykernel/comm/comm.py
+++ b/ipykernel/comm/comm.py
@@ -71,9 +71,8 @@ class Comm(traitlets.config.LoggingConfigurable, BaseComm):
     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)
 
 


Test patch:
diff --git a/ipykernel/tests/test_comm.py b/ipykernel/tests/test_comm.py
index 9dd49f8..f8b0764 100644
--- a/ipykernel/tests/test_comm.py
+++ b/ipykernel/tests/test_comm.py
@@ -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):
@@ -23,6 +23,7 @@ def test_comm(kernel):
     c.handle_close({})
     c.close()
     assert len(msgs) == 2
+    assert c.target_name == "bar"
 
 
 def test_comm_manager(kernel):