Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 530ac3d

Browse filesBrowse files
committed
Relax conditions for warning on updating converters
Allow sub/superclass without warning. This was motivated by Pandas, as they have several instances of the same class in the registry. We also had this internally, though resolved that by using the same instance for multiple registry entries rather than by relaxing the warning. This becomes impractical when dealing with downstream. It may have been sufficient to allow only identical types, but to be safe, decided to allow both sub- and superclass relationships. The purpose of the warning was that it gets overwritten without heeding prior data provided which would break in unexpected ways. The most common case for this is when one converter class operates on multiple data types, but separate instances of the class are in the registry. So while the previous data is compatible the equality check still failed. Requiring downstream to implement equality checks seems impractical. Additionally used both `is` and `==` for the earlier short circuit, which should in most cases be identical operations, but just in case.
1 parent 183b04f commit 530ac3d
Copy full SHA for 530ac3d

File tree

Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-2
lines changed

‎lib/matplotlib/axis.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axis.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,11 +1842,15 @@ def set_converter(self, converter):
18421842
self._converter_is_explicit = True
18431843

18441844
def _set_converter(self, converter):
1845-
if self._converter == converter:
1845+
if self._converter is converter or self._converter == converter:
18461846
return
18471847
if self._converter_is_explicit:
18481848
raise RuntimeError("Axis already has an explicit converter set")
1849-
elif self._converter is not None:
1849+
elif (
1850+
self._converter is not None and
1851+
not isinstance(converter, type(self._converter)) and
1852+
not isinstance(self._converter, type(converter))
1853+
):
18501854
_api.warn_external(
18511855
"This axis already has a converter set and "
18521856
"is updating to a potentially incompatible converter"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.