From 9b9c0c6fbdd53ec42e2a1edecc9c6895b6f7a3ef Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 25 Mar 2014 08:22:56 -0400 Subject: [PATCH] BUG : don't use mutable objects as dictionary keys Base key on the id of the transform. This maintains the old behavior and does not break the python hashable object model. changed the variable id -> pid so as to not shadow the method `id` Closes #2828 --- CHANGELOG | 2 ++ lib/matplotlib/backends/backend_ps.py | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 66610de4d391..7044b3c22e1a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +2014-06-07 Fixed bug so radial plots can be saved as ps in py3k. + 2014-06-01 Changed the fmt kwarg of errorbar to support the the mpl convention that "none" means "don't draw it", and to default to the empty string, so that plotting diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index 4ae07f2f784d..066cb00e1092 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -554,15 +554,16 @@ def _convert_path(self, path, transform, clip=False, simplify=None): return ps def _get_clip_path(self, clippath, clippath_transform): - id = self._clip_paths.get((clippath, clippath_transform)) - if id is None: - id = 'c%x' % len(self._clip_paths) - ps_cmd = ['/%s {' % id] + key = (clippath, id(clippath_transform)) + pid = self._clip_paths.get(key) + if pid is None: + pid = 'c%x' % len(self._clip_paths) + ps_cmd = ['/%s {' % pid] ps_cmd.append(self._convert_path(clippath, clippath_transform, simplify=False)) ps_cmd.extend(['clip', 'newpath', '} bind def\n']) self._pswriter.write('\n'.join(ps_cmd)) - self._clip_paths[(clippath, clippath_transform)] = id + self._clip_paths[key] = pid return id def draw_path(self, gc, path, transform, rgbFace=None):