Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Call IPython.enable_gui when install repl displayhook #28332

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

Merged

Conversation

ianthomas23
Copy link
Member

Closes #28324.

This fixes the use of plt.show(block=False) in ipython without specifying a particular backend beforehand. The recent refactor of backend handling in IPython/Matplotlib removed the call to ip.enable_gui in install_repl_displayhook but in this particular use case it is still needed. If a backend is specified in ipython beforehand (via ipython --matplotlib or %matplotlib for example) then IPython already knows about the correct event loop, but if not then IPython needs to be explicitly told about it via ip.enable_gui.

So really this is putting functionality back in that I erroneously removed in the backend refactor.

On macos the default macosx backend needs an extra fix in IPython that I will link to.

@ianthomas23
Copy link
Member Author

IPython PR is ipython/ipython#14451.

@timhoffm timhoffm added this to the v3.9.1 milestone Jun 3, 2024
@tacaswell tacaswell merged commit 03a73c8 into matplotlib:main Jun 3, 2024
41 of 44 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jun 3, 2024
@ianthomas23 ianthomas23 deleted the 28324_ipython_show_block_False branch June 3, 2024 17:00
QuLogic added a commit that referenced this pull request Jun 3, 2024
…332-on-v3.9.x

Backport PR #28332 on branch v3.9.x (Call IPython.enable_gui when install repl displayhook)
Carreau added a commit to ipython/ipython that referenced this pull request Jun 25, 2024
This is a bug that I discovered whilst dealing with
matplotlib/matplotlib#28332. The change here is in
`TerminalInteractiveShell.enable_gui` which needs to convert a gui of
`macosx` from Matplotlib into `osx` in IPython. It reuses the converter
function created in #14420.

I've added a test that uses `enable_gui` and raises an exception before
this PR but passes with it.

The remainder of the changes are formatting changes from `pre-commit`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: show(block=False) freezes
3 participants