8000 Error out in case of alias inheritance. · matplotlib/matplotlib@07a7311 · GitHub
[go: up one dir, main page]

Skip to content

Commit 07a7311

Browse files
committed
Error out in case of alias inheritance.
1 parent 52c6c77 commit 07a7311

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2783,7 +2783,8 @@ class so far, an alias named ``get_alias`` will be defined; the same will
27832783
exception will be raised.
27842784
27852785
The alias map is stored as the ``_alias_map`` attribute on the class and
2786-
can be used by `~.normalize_kwargs`.
2786+
can be used by `~.normalize_kwargs` (which assumes that higher priority
2787+
aliases come last).
27872788
"""
27882789
if cls is None:
27892790
return functools.partial(_define_aliases, alias_d)
@@ -2804,7 +2805,10 @@ def method(self, *args, **kwargs):
28042805
method.__doc__ = "alias for `{}`".format(prefix + prop)
28052806
setattr(cls, prefix + alias, method)
28062807
if not exists:
2807-
raise ValueError("property {} does not exist".format(prop))
2808+
raise ValueError(
2809+
"Neither getter nor setter exists for {!r}".format(prop))
28082810

2811+
if hasattr(cls, "_alias_map"):
2812+
raise NotImplementedError("Parent class already defines aliases")
28092813
cls._alias_map = alias_d
28102814
return cls

0 commit comments

Comments
 (0)
0