Skip to content
Open
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
19 changes: 18 additions & 1 deletion jupyter_client/win_interrupt.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,27 @@ class SECURITY_ATTRIBUTES(ctypes.Structure): # noqa
sa.nLength = ctypes.sizeof(SECURITY_ATTRIBUTES)
sa.lpSecurityDescriptor = 0
sa.bInheritHandle = 1
# ensure backward compatibility with older ParentPollerWindows
# implementations which relied on bManualReset to be set to False
# upon event creation
MANUAL_RESET_ATTR = "manual_reset"
if not hasattr(create_interrupt_event, MANUAL_RESET_ATTR):
manual_reset = False
try:
from ipykernel.parentpoller import ParentPollerWindows

if hasattr(ParentPollerWindows, "reset_event"):
manual_reset = True
except ImportError:
pass
finally:
setattr(create_interrupt_event, MANUAL_RESET_ATTR, manual_reset)
else:
manual_reset = getattr(create_interrupt_event, MANUAL_RESET_ATTR)

return ctypes.windll.kernel32.CreateEventA( # type:ignore[attr-defined]
sa_p,
False,
manual_reset,
False,
"", # lpEventAttributes # bManualReset # bInitialState
) # lpName
Expand Down