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 9d3b14c

Browse filesBrowse files
authored
Merge pull request #9070 from anntzer/no-renderer-uid
Replace use of renderer._uid by weakref.
2 parents d0eeddb + 8d22408 commit 9d3b14c
Copy full SHA for 9d3b14c

File tree

Expand file treeCollapse file tree

3 files changed

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

3 files changed

+2
-18
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
-12Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
from functools import partial
4343
import importlib
4444
import io
45-
import itertools
4645
import os
4746
import sys
4847
import time
@@ -101,12 +100,6 @@
101100
}
102101

103102

104-
# Used to ensure that caching based on renderer id() is unique without being as
105-
# expensive as a real UUID. 0 is used for renderers that don't derive from
106-
# here, so start at 1.
107-
_unique_renderer_id = itertools.count(1)
108-
109-
110103
def register_backend(format, backend, description=None):
111104
"""
112105
Register a backend for saving to a given file format.
@@ -277,12 +270,7 @@ class RendererBase(object):
277270
278271
"""
279272
def __init__(self):
280-
# A lightweight id for unique-ification purposes. Along with id(self),
281-
# the combination should be unique enough to use as part of a cache key.
282-
self._uid = next(_unique_renderer_id)
283-
284273
self._texmanager = None
285-
286274
self._text2path = textpath.TextToPath()
287275

288276
def open_group(self, s, gid=None):

‎lib/matplotlib/backends/backend_mixed.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_mixed.py
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import six
77

8-
import matplotlib.backend_bases
98
from matplotlib.backends.backend_agg import RendererAgg
109
from matplotlib.tight_bbox import process_figure_for_rasterizing
1110

@@ -50,9 +49,6 @@ def __init__(self, figure, width, height, dpi, vector_renderer,
5049
if raster_renderer_class is None:
5150
raster_renderer_class = RendererAgg
5251

53-
# See matplotlib.backend_bases.RendererBase._uid.
54-
self._uid = next(matplotlib.backend_bases._unique_renderer_id)
55-
5652
self._raster_renderer_class = raster_renderer_class
5753
self._width = width
5854
self._height = height

‎lib/matplotlib/text.py

Copy file name to clipboardExpand all lines: lib/matplotlib/text.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import math
1111
import warnings
12+
import weakref
1213

1314
import contextlib
1415

@@ -179,7 +180,6 @@ class Text(Artist):
179180
Handle storing and drawing of text in window or data coordinates.
180181
"""
181182
zorder = 3
182-
183183
_cached = maxdict(50)
184184

185185
def __repr__(self):
@@ -913,7 +913,7 @@ def get_prop_tup(self, renderer=None):
913913
self._verticalalignment, self._horizontalalignment,
914914
hash(self._fontproperties),
915915
self._rotation, self._rotation_mode,
916-
self.figure.dpi, id(renderer), getattr(renderer, '_uid', 0),
916+
self.figure.dpi, weakref.ref(renderer),
917917
self._linespacing
918918
)
919919

0 commit comments

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