matplotlib/matplotlib — pull request #2010 by mdboom (2013-05-15 13:52:30+00:00)
Title: Allow Paths to be marked as readonly

This PR is just to prevent the user from modifying the singleton Paths (unit_circle, unit_rectangle etc) which then cause nasty side effects for anything else that tries to use that Path later (such as the Marker infrastructure).

Issue #2003 recently "rediscovered" this bug, but we've seen it before.

1) Adds a readonly kwarg to the Path constructor
2) Mark all of the singleton paths as readonly
3) deepcopy those Paths in tests that need to modify the path.

The actual domain of this API change is fairly small, as most Paths created will still be mutable -- this only affects code that wants to modify one of the singleton Paths.