[issue40913] time.sleep ignores errors on Windows

2020-06-12 Thread Steve Dower
Steve Dower added the comment: > If WaitForSingleObjectEx fails, do you think the system error code should be > raised as an OSError? It's invalid (and unfixable) internal state, so perhaps SystemError makes the most sense? There's no point catching it in most cases. Or since we don't want

[issue40913] time.sleep ignores errors on Windows

2020-06-12 Thread Eryk Sun
Eryk Sun added the comment: If WaitForSingleObjectEx fails, do you think the system error code should be raised as an OSError? Probably an invalid-handle or access-denied error is too cryptic here. It may be better to raise something like RuntimeError('time.sleep(): invalid SIGINT event

[issue40913] time.sleep ignores errors on Windows

2020-06-12 Thread Steve Dower
Steve Dower added the comment: You could test this by getting the event and CloseHandle-ing it. A function to do this could be added to _testcapimodule. It'd have to run in its own process, but we have (a few) helpers around for this. Given the concerns, I don't think we should change this

[issue40913] time.sleep ignores errors on Windows

2020-06-12 Thread Steve Dower
Steve Dower added the comment: ... equally happy without an explicit test in anything that's only prerelease right now. -- ___ Python tracker ___

[issue40913] time.sleep ignores errors on Windows

2020-06-11 Thread Tim Golden
Tim Golden added the comment: Thanks, Eryk. I've had a couple of casts at this (and also with an eye to https://bugs.python.org/issue40912 in a very similar area). Trouble is I can't come up with a way of adding a set.. function which doesn't seem wholly artificial, given that it's

[issue40913] time.sleep ignores errors on Windows

2020-06-11 Thread Tim Golden
Change by Tim Golden : -- assignee: -> tim.golden ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40913] time.sleep ignores errors on Windows

2020-06-10 Thread Eryk Sun
Eryk Sun added the comment: > is there any straightforward way to cause WaitForSingleObjectEx to fail? The wait can fail for ERROR_INVALID_HANDLE or ERROR_ACCESS_DENIED (i.e. the handle lacks SYNCHRONIZE access). If _PyOS_SigintEvent were replaced with get/set functions, then a non-waitable

[issue40913] time.sleep ignores errors on Windows

2020-06-10 Thread Tim Golden
Tim Golden added the comment: Thinking about testing here.. is there any straightforward way to cause WaitForSingleObjectEx to fail? The code change would be fairly slight and amenable to inspection, but it would be good to actually test it ;) --

[issue40913] time.sleep ignores errors on Windows

2020-06-08 Thread Steve Dower
New submission from Steve Dower : In time.sleep on Windows, if the WaitForSingleObject call fails, the call returns success. It essentially looks like the timeout was 0. Errors should be highly unlikely, as the event object is leaked (see issue40912), but if they _do_ occur, we should raise