diff --git a/ipykernel/ipkernel.py b/ipykernel/ipkernel.py index d3bcab1d..b7cde21b 100644 --- a/ipykernel/ipkernel.py +++ b/ipykernel/ipkernel.py @@ -160,7 +160,10 @@ def __init__(self, **kwargs): self._new_threads_parent_header = {} self._initialize_thread_hooks() - gc.callbacks.append(self._clean_thread_parent_frames) + if hasattr(gc, "callbacks"): + # while `gc.callbacks` exists since Python 3.3, pypy does not + # implement it even as of 3.10. + gc.callbacks.append(self._clean_thread_parent_frames) help_links = List( [