[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread Guido van Rossum
Guido van Rossum added the comment: Thanks for the quick fix. It works! -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread Eryk Sun
Change by Eryk Sun : -- priority: release blocker -> stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread Eryk Sun
Eryk Sun added the comment: > That sounds like a micro-optimization which is not worth it. In the back of my mind I was also thinking to generalize the behavior at runtime whenever a signal is tripped by a non-Python thread (e.g. a thread created by an extension module or ctypes), instead

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +3.9regression -patch ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread STINNER Victor
STINNER Victor added the comment: > This code cannot be interrupted with ^C on Windows (e.g. in the REPL) I tested manually: it's now fixed in 3.9 and master branches. Thanks for the bug report Guido. Signal handling is hard. Threads + signals is worse! :-) I modified

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread STINNER Victor
STINNER Victor added the comment: > SIGNAL_PENDING_CALLS() is called on a Python thread via signal.raise_signal() > or _thread.interrupt_main() / PyErr_SetInterrupt(). If you'd rather keep the > COMPUTE_EVAL_BREAKER() call in that case, the console control-event case can > be distinguished

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread miss-islington
miss-islington added the comment: New changeset e5729aef6ff67ae7ed05dffc0855477823826191 by Miss Islington (bot) in branch '3.9': bpo-42296: On Windows, fix CTRL+C regression (GH-23257) https://github.com/python/cpython/commit/e5729aef6ff67ae7ed05dffc0855477823826191 --

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread Eryk Sun
Eryk Sun added the comment: > always interrupt and let the thread decide if it has something to do. SIGNAL_PENDING_CALLS() is called on a Python thread via signal.raise_signal() or _thread.interrupt_main() / PyErr_SetInterrupt(). If you'd rather keep the COMPUTE_EVAL_BREAKER() call in that

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 9.0 -> 10.0 pull_requests: +22156 pull_request: https://github.com/python/cpython/pull/23259 ___ Python tracker

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread STINNER Victor
STINNER Victor added the comment: New changeset d96a7a83133250377219227b5cfab4dbdddc5d3a by Victor Stinner in branch 'master': bpo-42296: On Windows, fix CTRL+C regression (GH-23257) https://github.com/python/cpython/commit/d96a7a83133250377219227b5cfab4dbdddc5d3a --

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +22154 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23257 ___ Python tracker ___

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-13 Thread STINNER Victor
STINNER Victor added the comment: This issue reminds me bpo-40082 where I wrote: "The problem on Windows is that each CTRL+c is executed in a different thread." I fixed the issue with: New changeset b54a99d6432de93de85be2b42a63774f8b4581a0 by Victor Stinner in branch 'master': bpo-40082:

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-12 Thread Eryk Sun
Eryk Sun added the comment: Note that this issue only applies to a process that has a single Python thread. With multiple Python threads, the signal handler gets called when the main thread acquires the GIL. As far as Windows console-driven SIGINT and SIGBREAK are concerned, C

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-12 Thread Steve Dower
Steve Dower added the comment: This looks like the smallest change I can make to fix it: diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h index 0cd5550cfd..9ff740b87b 100644 --- a/Include/internal/pycore_pystate.h +++ b/Include/internal/pycore_pystate.h @@

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-12 Thread Guido van Rossum
Guido van Rossum added the comment: Can you think of a fix? (Presumably restore some code that was deleted from 3.9?) -- ___ Python tracker ___

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-09 Thread Eryk Sun
Eryk Sun added the comment: Yes, if I force the return value of _Py_ThreadCanHandleSignals to 1, the loop is broken by a KeyboardInterrupt. -- ___ Python tracker ___

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-09 Thread Guido van Rossum
Guido van Rossum added the comment: So you're saying this war broken by https://github.com/python/cpython/pull/19087 ? -- ___ Python tracker ___

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-09 Thread Eryk Sun
Eryk Sun added the comment: See bpo-40010. COMPUTE_EVAL_BREAKER() in Python/ceval.c -- or _Py_ThreadCanHandleSignals in Include/internal/pycore_pystate.h -- needs to take into account that SIGNAL_PENDING_SIGNALS() gets called on a completely new thread in Windows. --

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-09 Thread Eryk Sun
Change by Eryk Sun : -- nosy: +vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-09 Thread Eryk Sun
Eryk Sun added the comment: It also cannot be interrupted in 3.9. But 3.8 and earlier work correctly. -- nosy: +eryksun type: -> behavior versions: +Python 3.9 ___ Python tracker

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-09 Thread Guido van Rossum
Change by Guido van Rossum : -- priority: normal -> release blocker ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-09 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-09 Thread Guido van Rossum
New submission from Guido van Rossum : This code cannot be interrupted with ^C on Windows (e.g. in the REPL) while True: pass This seems to be a regression, it works in earlier versions. -- messages: 380597 nosy: Mark.Shannon, gvanrossum, steve.dower priority: normal severity:

[issue42296] Infinite loop uninterruptable on Windows in 3.10

2020-11-09 Thread Guido van Rossum
Change by Guido van Rossum : -- components: +Windows nosy: +paul.moore, tim.golden, zach.ware ___ Python tracker ___ ___