[issue21870] Ctrl-C doesn't interrupt simple loop
STINNER Victor
report at bugs.python.org
Fri Jun 27 00:41:18 CEST 2014
STINNER Victor added the comment:
The problem is in the ceval.c, the core of Python bytecode interpreter. For performances, it doesn't check if pending calls should be called for each instructio. It uses "fast dispatch" which doesn't check pending calls. The problem is that a signal schedules a pending call. The scheduled call is never executed on Python 2.
Python 3.2 introduced an atomic eval_breaker variable which fixes this issue. It is part of the huge change "new GIL":
---
changeset: 57175:fdd6484f1210
parent: 57172:6d91aaadddd0
user: Antoine Pitrou <solipsis at pitrou.net>
date: Tue Nov 10 19:50:40 2009 +0000
files: Include/ceval.h Include/pystate.h Include/sysmodule.h Lib/test/test_sys.py Makefile.pre.in Objects/longob
description:
Merge in the new GIL.
---
I'm not sure that it would be possible to only backport the "eval_breaker" variable. Anyway, changing ceval.c in minor Python 2.7 release is risky. I would prefer to close the bug as wontfix. IMO the safe solution is to upgrade to Python 3.2 or later.
----------
nosy: +haypo, pitrou
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21870>
_______________________________________
More information about the Python-bugs-list
mailing list