Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f47dcc2

Browse files
tacaswelltobias47n9e
authored andcommitted
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
1 parent 4853892 commit f47dcc2

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2014-06-07 Fixed bug so radial plots can be saved as ps in py3k.
2+
13
2014-06-01 Changed the fmt kwarg of errorbar to support the
24
the mpl convention that "none" means "don't draw it",
35
and to default to the empty string, so that plotting

lib/matplotlib/backends/backend_ps.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -554,15 +554,16 @@ def _convert_path(self, path, transform, clip=False, simplify=None):
554554
return ps
555555

556556
def _get_clip_path(self, clippath, clippath_transform):
557-
id = self._clip_paths.get((clippath, clippath_transform))
558-
if id is None:
559-
id = 'c%x' % len(self._clip_paths)
560-
ps_cmd = ['/%s {' % id]
557+
key = (clippath, id(clippath_transform))
558+
pid = self._clip_paths.get(key)
559+
if pid is None:
560+
pid = 'c%x' % len(self._clip_paths)
561+
ps_cmd = ['/%s {' % pid]
561562
ps_cmd.append(self._convert_path(clippath, clippath_transform,
562563
simplify=False))
563564
ps_cmd.extend(['clip', 'newpath', '} bind def\n'])
564565
self._pswriter.write('\n'.join(ps_cmd))
565-
self._clip_paths[(clippath, clippath_transform)] = id
566+
self._clip_paths[key] = pid
566567
return id
567568

568569
def draw_path(self, gc, path, transform, rgbFace=None):

0 commit comments

Comments
 (0)