This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Interpreter should be interruptable everywhere
Type: enhancement Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: exarkun, georg.brandl, georg.brandl, rhettinger, terry.reedy
Priority: low Keywords:

Created on 2004-10-09 04:26 by exarkun, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg54283 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2004-10-09 04:26
import itertools
list(itertools.repeat('x'))

^C will not interrupt this.
msg54284 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-10-10 08:06
Logged In: YES 
user_id=80475

FWIW, there are many variations of this theme using almost
anything accepting an iterable input (dict.fromkeys, tuple,
set, etc) paired with any long running or infinite iterator
(itertools.count, xrange(sys.maxint), etc).  Even the
tp_print slot can get caught up in emitting oversized output
in a way that is uninterruptable.

I don't see a clean way of teaching all of these functions
to periodically check for signals, and either handle them,
raise an exception or continue.   Fixing this could muck-up
and complicate a bunch of otherwise clean code.  

Still, it would be nice if everything were interruptable. 
I'm just not sure it's worth it.
msg54285 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2004-10-15 22:25
Logged In: YES 
user_id=593130

Killing the interpreter will, of course, interrupt anything ;-).

The ability to ask the interpreter, via an alternate non-code 
communication channel, to stop doing what one just 
requested via the normal code input channel,  is an 
implementation-specific metafeature independent of the 
language definition.  So I see this as a CPython feature-
expansion request rather than a bug report.

If the CPython interpreter documentation promises that ^C 
or whatever will always grab the interpreter's attention, then 
that overpromise is a bug that should be modified.
msg54286 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-01-10 22:15
Logged In: YES 
user_id=1188172

What to do here?
msg54287 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-10-12 12:40
Logged In: YES 
user_id=849994

Turning into a feature request.
History
Date User Action Args
2022-04-11 14:56:07adminsetgithub: 40996
2004-10-09 04:26:41exarkuncreate