Skip to content

Navigation Menu

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

artist.axes and .figure should never be reassignable #6793

Copy link
Copy link
Closed
@anntzer

Description

@anntzer
Issue body actions

#3835 ensured that the .axes attribute of an artist cannot be assigned to a new Axes when it is already set to an earlier Axes. However, it does not prevent one from doing so by going via None. Also, nothing is done regarding reassignment of .figure.

In practice there's plenty of code that assumes these invariants (see #6785 for how I ended up here), so I'd suggest tightening the restrictions to

  • .axes can only ever be set to a non-None value once. Upon removal of the artist from an axes, the private attribute ._discarded is set to prevent further reuse. (If there is truly need for it, we could add a .copy() method that would return, well, a copy of the artist, but with ._discarded unset, so that it can be reassigned to a new Axes.)
  • .figure follows the same rules, and is additionally automatically set/unset whenever .axes is set/unset.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: inactiveMarked by the “Stale” Github ActionMarked by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

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