8000 Fix Path deepcopy signature · matplotlib/matplotlib@026fe3f · GitHub
[go: up one dir, main page]

Skip to content

Commit 026fe3f

Browse files
committed
Fix Path deepcopy signature
**Problem** Path.__deepcopy__ does not accept a second(`memo`) parameter, so the common usage of the `deepcopy` function fails. **Solution** Add second parameter.
1 parent 0cfc7a8 commit 026fe3f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/matplotlib/path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def __copy__(self):
297297

298298
copy = __copy__
299299

300-
def __deepcopy__(self):
300+
def __deepcopy__(self, memo=None):
301301
"""
302302
Returns a deepcopy of the `Path`. The `Path` will not be
303303
readonly, even if the source `Path` is.

lib/matplotlib/tests/test_path.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
3+
import copy
34

45
import six
56

@@ -172,6 +173,13 @@ def test_path_to_polygons():
172173
assert_array_equal(p.to_polygons(closed_only=False), [data])
173174

174175

176+
def test_path_deepcopy():
177+
# Should not raise any error
178+
verts = [[0, 0], [1, 1]]
179+
path = Path(verts)
180+
copy.deepcopy(path)
181+
182+
175183
if __name__ == '__main__':
176184
import nose
177185
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)
0