8000 MNT: Deprecate other capitalization than "None" in matplotlibrc · matplotlib/matplotlib@61a0829 · GitHub
[go: up one dir, main page]

Skip to content

Commit 61a0829

Browse files
rcomertimhoffm
authored andcommitted
MNT: Deprecate other capitalization than "None" in matplotlibrc
The `*_or_None` validators have accepted any capitalization of the string "none" as input. This is overly permissive and will likely lead to conflicts in the future because we cannot distinguish between resolving to `None` and `"none"` which may be need for some parameters in the future. Inspired by #29481.
1 parent 9e3ada3 commit 61a0829

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/matplotlib/rcsetup.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,13 @@ def _make_type_validator(cls, *, allow_none=False):
191191
def validator(s):
192192
if (allow_none and
193193
(s is None or cbook._str_lower_equal(s, "none"))):
194+
if cbook._str_lower_equal(s, "none") and s != "None":
195+
_api.warn_deprecated(
196+
"3.11",
197+
message=f"Using the capitalization {s!r} in matplotlibrc for "
198+
"*None* is deprecated in %(removal)s and will leaa to "
199+
"an error two versions later. Please use 'None' instead."
200+
)
194201
return None
195202
if cls is str and not isinstance(s, str):
196203
raise ValueError(f'Could not convert {s!r} to str')

0 commit comments

Comments
 (0)
0