Skip to content

Commit 1188b83

Browse files
authored
Merge pull request #24601 from meeseeksmachine/auto-backport-of-pr-24600-on-v3.6.x
Backport PR #24600 on branch v3.6.x (Fix: Gracefully fail the string validator for tuple inputs)
2 parents 382db61 + 149ab12 commit 1188b83

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/matplotlib/rcsetup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __call__(self, s):
6868
name, = (k for k, v in globals().items() if v is self)
6969
_api.warn_deprecated(
7070
self._deprecated_since, name=name, obj_type="function")
71-
if self.ignorecase:
71+
if self.ignorecase and isinstance(s, str):
7272
s = s.lower()
7373
if s in self.valid:
7474
return self.valid[s]

lib/matplotlib/tests/test_rcparams.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import copy
22
import os
33
from pathlib import Path
4+
import re
45
import subprocess
56
import sys
67
from unittest import mock
@@ -591,3 +592,10 @@ def test_deprecation(monkeypatch):
591592
# Note that the warning suppression actually arises from the
592593
# iteration over the updater rcParams being protected by
593594
# suppress_matplotlib_deprecation_warning, rather than any explicit check.
595+
596+
597+
def test_rcparams_legend_loc():
598+
value = (0.9, .7)
599+
match_str = f"{value} is not a valid value for legend.loc;"
600+
with pytest.raises(ValueError, match=re.escape(match_str)):
601+
mpl.RcParams({'legend.loc': value})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy