Skip to content

Commit 8407ffc

Browse files
authored
Merge pull request #8261 from anntzer/name-validators-in-rcsetup
Set __name__ for list validators in rcsetup.
2 parents 296bc4f + b4ee5db commit 8407ffc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/matplotlib/rcsetup.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,13 @@ def f(s):
9595
return [scalar_validator(v) for v in s
9696
if not isinstance(v, six.string_types) or v]
9797
else:
98-
msg = "{0!r} must be of type: string or non-dictionary iterable.".format(s)
99-
raise ValueError(msg)
98+
raise ValueError("{!r} must be of type: string or non-dictionary "
99+
"iterable".format(s))
100+
# Cast `str` to keep Py2 happy despite `unicode_literals`.
101+
try:
102+
f.__name__ = str("{}list".format(scalar_validator.__name__))
103+
except AttributeError: # class instance.
104+
f.__name__ = str("{}List".format(type(scalar_validator).__name__))
100105
f.__doc__ = scalar_validator.__doc__
101106
return f
102107

0 commit comments

Comments
 (0)