After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 96018 - Make Ctrl-C raise KeyboardInterrupt in pygtk programs
Make Ctrl-C raise KeyboardInterrupt in pygtk programs
Status: RESOLVED DUPLICATE of bug 72333
Product: pygtk
Classification: Bindings
Component: general
1.99.x/2.0.x
Other Linux
: Normal normal
: ---
Assigned To: James Henstridge
James Henstridge
Depends on:
Blocks:
 
 
Reported: 2002-10-17 03:22 UTC by Johan (not receiving bugmail) Dahlin
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
v1: Create a timeout function in _wrap_gtk_main() which is called every 100ms (934 bytes, patch)
2002-10-17 20:42 UTC, Johan (not receiving bugmail) Dahlin
none Details | Review
v2: Don't call gtk_main_quit, don't return FALSE. remove the handler after gtk_main (1.03 KB, patch)
2002-10-21 17:19 UTC, Johan (not receiving bugmail) Dahlin
none Details | Review

Description Johan (not receiving bugmail) Dahlin 2002-10-17 03:22:00 UTC
Currently all pygtk programs ignore Contrl-C. 
I guess this is because when gtk.main(loop) is being called the python
interpretor is left aside without a chance to breath. 
Is it enough to add a function that's called every, say 100ms that allows
the interpretor to think a bit (PyAddPendingCalls or something).
Comment 1 Johan (not receiving bugmail) Dahlin 2002-10-17 20:42:07 UTC
Created attachment 11647 [details] [review]
v1: Create a timeout function in _wrap_gtk_main() which is called every 100ms
Comment 2 Johan (not receiving bugmail) Dahlin 2002-10-17 20:43:43 UTC
I benchmarked Py_MakePendingCalls a bit, and it takes more or less no
cpu time at all. So i don't think 100ms is too often. Maybe we could
lower it a bit to get more responsive Ctrl-C. But it's not a too big deal.
Comment 3 Johan (not receiving bugmail) Dahlin 2002-10-21 17:19:00 UTC
Created attachment 11734 [details] [review]
v2: Don't call gtk_main_quit, don't return FALSE. remove the handler after gtk_main
Comment 4 James Henstridge 2002-10-22 06:50:08 UTC
this is a dup of bug 72333 but I won't mark it as such, as it has a patch.

As discussed on IRC, there are a few problems with the patch:
  - sets up a new timeout every time gtk.main() is called (causes
    multiple timeouts to fire in recursive main loops).
  - uses gtk_signal_remove() to dequeue the timeout
  - should be calling PyErr_CheckSignals() instead of
    Py_MakePendingCalls().  (apparently Py_MakePendingCalls() is set
    to be deprecated).
Comment 5 Johan (not receiving bugmail) Dahlin 2002-11-04 19:26:37 UTC
Closing. 

Will attach new patch on bug 72333 shortly

*** This bug has been marked as a duplicate of 72333 ***