Skip to content

Commit 743a005

Browse files
authored
Merge pull request matplotlib#29529 from timhoffm/mnt-matplotlibrc-none
MNT: Deprecate other capitalization than "None" in matplotlibrc
2 parents 6c5e3f3 + 5c8c9b5 commit 743a005

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Capitalization of None in matplotlibrc
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
In :file:`matplotlibrc` config files every capitalization of None was
5+
accepted for denoting the Python constant `None`. This is deprecated. The
6+
only accepted capitalization is now None, i.e. starting with a capital letter
7+
and all other letters in lowercase.

lib/matplotlib/rcsetup.py

+8
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ 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 lead to an "
199+
"error from version 3.13 onward. Please use 'None' "
200+
"instead."
201+
)
194202
return None
195203
if cls is str and not isinstance(s, str):
196204
raise ValueError(f'Could not convert {s!r} to str')

0 commit comments

Comments
 (0)