From f3a4129ebfa8de431ad11b5e9598d3fca12645a6 Mon Sep 17 00:00:00 2001 From: Paolo Tosco Date: Sat, 20 Sep 2025 15:58:15 +0200 Subject: [PATCH 1/3] Set event manual reset flag to true --- jupyter_client/win_interrupt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyter_client/win_interrupt.py b/jupyter_client/win_interrupt.py index 1ba2c3af..bcd03232 100644 --- a/jupyter_client/win_interrupt.py +++ b/jupyter_client/win_interrupt.py @@ -34,7 +34,7 @@ class SECURITY_ATTRIBUTES(ctypes.Structure): # noqa return ctypes.windll.kernel32.CreateEventA( # type:ignore[attr-defined] sa_p, - False, + True, False, "", # lpEventAttributes # bManualReset # bInitialState ) # lpName From de72b45023679c70b9963644ad16251cdee5a7e7 Mon Sep 17 00:00:00 2001 From: Paolo Tosco Date: Fri, 17 Oct 2025 20:00:14 +0200 Subject: [PATCH 2/3] address review comment --- jupyter_client/win_interrupt.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/jupyter_client/win_interrupt.py b/jupyter_client/win_interrupt.py index bcd03232..873cdf93 100644 --- a/jupyter_client/win_interrupt.py +++ b/jupyter_client/win_interrupt.py @@ -31,10 +31,26 @@ 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, - True, + manual_reset, False, "", # lpEventAttributes # bManualReset # bInitialState ) # lpName From 6b1125f37bedfa4d32001eda52927118a2987d22 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 17 Oct 2025 18:01:03 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- jupyter_client/win_interrupt.py | 1 + 1 file changed, 1 insertion(+) diff --git a/jupyter_client/win_interrupt.py b/jupyter_client/win_interrupt.py index 873cdf93..3c673ff6 100644 --- a/jupyter_client/win_interrupt.py +++ b/jupyter_client/win_interrupt.py @@ -39,6 +39,7 @@ class SECURITY_ATTRIBUTES(ctypes.Structure): # noqa manual_reset = False try: from ipykernel.parentpoller import ParentPollerWindows + if hasattr(ParentPollerWindows, "reset_event"): manual_reset = True except ImportError: