Skip to content
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: 4 additions & 1 deletion jupyter_client/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ def __init__(self, context=None, session=None, address=None):
@staticmethod
@atexit.register
def _notice_exit():
HBChannel._exiting = True
# Class definitions can be torn down during interpreter shutdown.
# We only need to set _exiting flag if this hasn't happened.
if HBChannel is not None:
HBChannel._exiting = True

def _create_socket(self):
if self.socket is not None:
Expand Down
5 changes: 4 additions & 1 deletion jupyter_client/threaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ def __init__(self, loop):
@staticmethod
@atexit.register
def _notice_exit():
IOLoopThread._exiting = True
# Class definitions can be torn down during interpreter shutdown.
# We only need to set _exiting flag if this hasn't happened.
if IOLoopThread is not None:
IOLoopThread._exiting = True

def run(self):
"""Run my loop, ignoring EINTR events in the poller"""
Expand Down