JuliaPy / JuliaPy/PyCall.jl

Control-C exits Julia after pylab.plot()

Open
#35 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

After the wx event loop gets started, SIGINT kills the Julia repl instead of interrupting the currently executing command. To reproduce:

``` julia
julia> using PyCall

julia> @pylab

julia> pylab.plot(1);
```

At this point, if I close the plot and press ^C, Julia exits.

In the IPython source, it says that [wx resets the SIGINT handler when it's loaded](https://github.com/ipython/ipython/blob/master/IPython/lib/inputhookwx.py#L120), so I tried running `ccall(:jl_install_sigint_handler, Void, ())` the first time `app.o != pynothing` in [gui.jl](https://github.com/stevengj/PyCall.jl/blob/master/src/gui.jl#L98). This is an improvement, in that ^C now works if something is running, but something is still off, since ^C without anything running exits Julia instead of returning to the prompt.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reproduction using PyCall, @pylab, and pylab.plot(1), then read src/gui.jl around the app.o handling and the linked IPython inputhookwx.py SIGINT logic. The fix is done when closing the plot and pressing ^C interrupts active work without exiting Julia, and pressing ^C at an idle prompt returns to the prompt.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia, python
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.