File tree 2 files changed +16
-2
lines changed
Filter options
2 files changed +16
-2
lines changed
Original file line number Diff line number Diff line change @@ -168,8 +168,11 @@ def backward_compatible_entry_points(
168
168
def _validate_and_store_entry_points (self , entries ):
169
169
# Validate and store entry points so that they can be used via matplotlib.use()
170
170
# in the normal manner. Entry point names cannot be of module:// format, cannot
171
- # shadow a built-in backend name, and cannot be duplicated.
172
- for name , module in entries :
171
+ # shadow a built-in backend name, and there cannot be multiple entry points
172
+ # with the same name but different modules. Multiple entry points with the same
173
+ # name and value are permitted (it can sometimes happen outside of our control,
174
+ # see https://github.com/matplotlib/matplotlib/issues/28367).
175
+ for name , module in set (entries ):
173
176
name = name .lower ()
174
177
if name .startswith ("module://" ):
175
178
raise RuntimeError (
Original file line number Diff line number Diff line change @@ -121,6 +121,17 @@ def test_entry_point_name_duplicate(clear_backend_registry):
121
121
[('some_name' , 'module1' ), ('some_name' , 'module2' )])
122
122
123
123
124
+ def test_entry_point_identical (clear_backend_registry ):
125
+ # Issue https://github.com/matplotlib/matplotlib/issues/28367
126
+ # Multiple entry points with the same name and value (value is the module)
127
+ # are acceptable.
128
+ n = len (backend_registry ._name_to_module )
129
+ backend_registry ._validate_and_store_entry_points (
130
+ [('some_name' , 'some.module' ), ('some_name' , 'some.module' )])
131
+ assert len (backend_registry ._name_to_module ) == n + 1
132
+ assert backend_registry ._name_to_module ['some_name' ] == 'module://some.module'
133
+
134
+
124
135
def test_entry_point_name_is_module (clear_backend_registry ):
125
136
with pytest .raises (RuntimeError ):
126
137
backend_registry ._validate_and_store_entry_points (
You can’t perform that action at this time.
0 commit comments