-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access violation due to CancelSynchronousIo of console read #74423
Comments
When ReadConsole is canceled by CancelSynchronousIo 1, for some reason the call still succeeds. It's probably related to the hack that maps STATUS_ALERTED to ERROR_OPERATION_ABORTED when a console read is interrupted by Ctrl+C. The problem is that, when canceled, ReadConsole doesn't update the value of lpNumberOfCharsRead. Thus in read_console_w in Modules/_io/winconsoleio.c, the value of For example, in 3.6: import sys, ctypes, threading
kernel32 = ctypes.WinDLL('kernel32')
hMain = kernel32.OpenThread(1, 0, kernel32.GetCurrentThreadId())
t = threading.Timer(30, kernel32.CancelSynchronousIo, (hMain,))
t.start()
sys.stdin.readline()
If the value of
|
Oops, I pasted the MSDN link for ReadConsole instead of CancelSynchronousIo 1. |
PR 7911 was merged and backported. Should this issue be closed? |
Yep, thanks for the ping! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: