Skip to content

Enable ProactorEventLoop on windows for ipykernel#1469

Open
NewUserHa wants to merge 7 commits intoipython:mainfrom
NewUserHa:patch-2
Open

Enable ProactorEventLoop on windows for ipykernel#1469
NewUserHa wants to merge 7 commits intoipython:mainfrom
NewUserHa:patch-2

Conversation

@NewUserHa
Copy link
Contributor

see #1468

@ZupoLlask
Copy link

Hello @NewUserHa,

Thanks for your work here!

Dear @ianthomas23,

Is it possible to get this merged on the next release?

It is really important for Windows users, as current solution creates incompatibilities between libraries.

Thank you!

@ianthomas23
Copy link
Collaborator

@ZupoLlask It is not passing CI, so of course it will not be merged.

@ZupoLlask
Copy link

@NewUserHa Can you please have a look at this? TY

@NewUserHa
Copy link
Contributor Author

I have no idea how this occur. this modification works in previous versions of ipython

@NewUserHa NewUserHa force-pushed the patch-2 branch 3 times, most recently from 37bad2c to 903b031 Compare February 24, 2026 20:28
@NewUserHa
Copy link
Contributor Author

the tests/test_debugger.py::test_stop_on_breakpoint issue seems to be related to IOStream.flush timed out and pyzmq ioloop and proactoreventloop.
it may need help

@ianthomas23
Copy link
Collaborator

@NewUserHa There were some problems with the CI that I think I have now fixed, so can you rebase this on main to see what is still failing? I should be able to help next week with any further problems here.

@NewUserHa
Copy link
Contributor Author

PR modified:

  1. test_async.py: asyncio>asynclib. reason: was typo
  2. zmqshell.py‎: warnings.filterwarnings("ignore",. the test test_async has no issue before changing to proactor eventloop. reason: because when user command is autowait ..., it is ran within the asyncio loop of ipykernel. after changing to proactoreventloop, autowait trio trio will prompt it need to be set running with guest mode. but there's no a good way to set that by dynamically detecting the user commands, and it works fine without setting that guest mode, except reciving the prompts from trio. therefore the fix is disabling the warning.
  3. eventloops.py‎: blocking_poll(). reason: because ProactorEventLoop has no add_reader method and IOCP doesn't support ZMQ's FD directly, therefore use a thread to wait the poll() in a blocking way to make it work. the other solution is to warp the FD into a handle and use IocpProactor class 's handle wait_for_handle method to wait it, but it needs win32api to wrap. even though the latter method looks better but the former is more straightforward, so the fomer method is used.

current:

  1. the fix of def loop_asyncio(kernel): of eventloops.py seemes to have no relation with the failed tests. whether it's fixed, the tests still pass. the loop_asyncio() seems to be not used or not covered.
  2. the remained failed test test_stop_on_breakpoint, it seems that the debugpy did send the stopped msg, but the main loop of ipykernel seems to be unable to recive it because of the hread of the main loop of ipykernel is paused by debugpy. the IOStream.flush timed out can be seen after manually set the debug flag of ioPub class to True.
    but the selectoreventloop has no this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants