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

Skip to content

Commit 106b341

Browse files
timhoffmMeeseeksDev[bot]
authored and
MeeseeksDev[bot]
committed
Backport PR #12022: Remove intent to deprecate rcParams["backend_fallback"].
1 parent af1bce3 commit 106b341

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

lib/matplotlib/pyplot.py

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -72,26 +72,6 @@
7272
_log = logging.getLogger(__name__)
7373

7474

75-
## Backend detection ##
76-
77-
78-
# FIXME: Deprecate.
79-
def _backend_selection():
80-
"""
81-
If rcParams['backend_fallback'] is true, we will check (at backend
82-
load-time) to see if the current backend is compatible with the current
83-
running event loop, and if not switches to a compatible one.
84-
"""
85-
if rcParams["backend_fallback"]:
86-
if (dict.__getitem__(rcParams, "backend") in _interactive_bk
87-
and _get_running_interactive_framework()):
88-
dict.__setitem__(
89-
rcParams, "backend", rcsetup._auto_backend_sentinel)
90-
91-
92-
_backend_selection()
93-
94-
9575
## Global ##
9676

9777

@@ -2380,16 +2360,23 @@ def _autogen_docstring(base):
23802360
return lambda func: addendum(docstring.copy_dedent(base)(func))
23812361

23822362

2383-
# just to be safe. Interactive mode can be turned on without
2363+
# If rcParams['backend_fallback'] is true, and an interactive backend is
2364+
# requested, ignore rcParams['backend'] and force selection of a backend that
2365+
# is compatible with the current running interactive framework.
2366+
if (rcParams["backend_fallback"]
2367+
and dict.__getitem__(rcParams, "backend") in _interactive_bk
2368+
and _get_running_interactive_framework()):
2369+
dict.__setitem__(rcParams, "backend", rcsetup._auto_backend_sentinel)
2370+
# Set up the backend.
2371+
switch_backend(rcParams["backend"])
2372+
2373+
# Just to be safe. Interactive mode can be turned on without
23842374
# calling `plt.ion()` so register it again here.
23852375
# This is safe because multiple calls to `install_repl_displayhook`
23862376
# are no-ops and the registered function respect `mpl.is_interactive()`
23872377
# to determine if they should trigger a draw.
23882378
install_repl_displayhook()
23892379

2390-
# Set up the backend.
2391-
switch_backend(rcParams["backend"])
2392-
23932380

23942381
################# REMAINING CONTENT GENERATED BY boilerplate.py ##############
23952382

0 commit comments

Comments
 (0)