Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctrl-C does not terminate GTK3 Gtk.main() loop when program run from command line #58346

Closed
NarnieHarshoe mannequin opened this issue Feb 27, 2012 · 3 comments
Closed
Labels
type-bug An unexpected behavior, bug, or error

Comments

@NarnieHarshoe
Copy link
Mannequin

NarnieHarshoe mannequin commented Feb 27, 2012

BPO 14138

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2012-02-27.07:52:49.654>
created_at = <Date 2012-02-27.03:13:27.731>
labels = ['type-bug', 'invalid']
title = 'Ctrl-C does not terminate GTK3 Gtk.main() loop when program run from command line'
updated_at = <Date 2012-02-27.23:50:21.367>
user = 'https://bugs.python.org/NarnieHarshoe'

bugs.python.org fields:

activity = <Date 2012-02-27.23:50:21.367>
actor = 'Narnie.Harshoe'
assignee = 'none'
closed = True
closed_date = <Date 2012-02-27.07:52:49.654>
closer = 'neologix'
components = ['None']
creation = <Date 2012-02-27.03:13:27.731>
creator = 'Narnie.Harshoe'
dependencies = []
files = []
hgrepos = []
issue_num = 14138
keywords = []
message_count = 3.0
messages = ['154427', '154437', '154519']
nosy_count = 2.0
nosy_names = ['neologix', 'Narnie.Harshoe']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue14138'
versions = ['Python 2.7']

@NarnieHarshoe
Copy link
Mannequin Author

NarnieHarshoe mannequin commented Feb 27, 2012

In a normal python program, Ctrl-C will set up a KeyboardInterrupt and terminate the program. This works with a normal python script, including GTK2 gtk.main(), but GTK3 Gtk.main() (even when used in a more robust GTK program that coded below) will not terminate with Ctrl-C requiring a Ctrl-Z and killing the job to terminate. See the commmand line output below:

$ python -c "while True:
>  pass
> "
^CTraceback (most recent call last):
  File "<string>", line 1, in <module>
KeyboardInterrupt


$ python -c "import gtk
> gtk.main()
> "
^CTraceback (most recent call last):
  File "<string>", line 2, in <module>
KeyboardInterrupt
$ python -c "from gi.repository import Gtk
> Gtk.main()
> "
^C
^C
^Z
[1]+  Stopped                 python -c "from gi.repository import Gtk
Gtk.main()
"
$ kill %1

[1]+ Stopped python -c "from gi.repository import Gtk
Gtk.main()
"

The behaviour under Gtk.main() should be changed to respond to the KeyboardInterrupt.

@neologix
Copy link
Mannequin

neologix mannequin commented Feb 27, 2012

The behaviour under Gtk.main() should be changed to respond to the
KeyboardInterrupt.

Well, you should report that to (Py)GTK folks then :-)
Either they set up a SIGINT handler, or they catch the KeyboardInterrupt exception, but that's not a problem with Python.
Closing.

@neologix neologix mannequin closed this as completed Feb 27, 2012
@neologix neologix mannequin added invalid type-bug An unexpected behavior, bug, or error labels Feb 27, 2012
@NarnieHarshoe
Copy link
Mannequin Author

NarnieHarshoe mannequin commented Feb 27, 2012

Understood. I didn't realize it was 3rd party.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

0 participants