Skip to content

Commit 7264112

Browse files
committed
FIX: ignore empty backend value in matplotlibrc
See comment in code. Accounts for the fact that we can to directly specify the "fallback" backend value. This interprets the lack of a backend entry and an empty backend entry the same. closes matplotlib#19848
1 parent 01f4b57 commit 7264112

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎lib/matplotlib/__init__.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,17 @@ def _rc_params_in_file(fname, transform=lambda x: x, fail_on_error=False):
769769

770770
for key, (val, line, line_no) in rc_temp.items():
771771
if key in rcsetup._validators:
772+
# the backend parameter is special because the default value can
773+
# not be expressed in the matplotlibrc file (the default is an
774+
# internal sentinel to indicated that we should do backend fallback
775+
# which picks the first importable interactive backend we find).
776+
#
777+
# This allows the backend parameter to be unset (as opposed to
778+
# not present) in the matplotlibrc file. This is important because
779+
# the defaults are pulled from a (fully commented out) template
780+
# including with the installation.
781+
if key == 'backend' and val == '':
782+
continue
772783
if fail_on_error:
773784
config[key] = val # try to convert to proper type or raise
774785
else:

0 commit comments

Comments
 (0)