diff --git a/doc/api/next_api_changes/deprecations/ 29529-TH.rst b/doc/api/next_api_changes/deprecations/ 29529-TH.rst new file mode 100644 index 000000000000..e396e68c4aa1 --- /dev/null +++ b/doc/api/next_api_changes/deprecations/ 29529-TH.rst @@ -0,0 +1,7 @@ +Capitalization of None in matplotlibrc +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In :file:`matplotlibrc` config files every capitalization of None was +accepted for denoting the Python constant `None`. This is deprecated. The +only accepted capitalization is now None, i.e. starting with a capital letter +and all other letters in lowercase. diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 04beb8126b74..e35517b07d19 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -191,6 +191,14 @@ def _make_type_validator(cls, *, allow_none=False): def validator(s): if (allow_none and (s is None or cbook._str_lower_equal(s, "none"))): + if cbook._str_lower_equal(s, "none") and s != "None": + _api.warn_deprecated( + "3.11", + message=f"Using the capitalization {s!r} in matplotlibrc for " + "*None* is deprecated in %(removal)s and will lead to an " + "error from version 3.13 onward. Please use 'None' " + "instead." + ) return None if cls is str and not isinstance(s, str): raise ValueError(f'Could not convert {s!r} to str')