Skip to content

Deprecate Transform.__array__ in favor of Transform.get_affine and Affine2D.__array__ #7975

Open
@anntzer

Description

@anntzer

The Transform class defines an __array__ method so that it can be passed (as an affine transformation matrix) to C-level code. Unfortunately, such method necessarily drops the nonlinear part of the transform (which cannot be represented in the matrix), and does so silently, leading to bugs such as the one fixed by #7844.

I thus suggest deprecating Transform.__array__ while keeping a nondeprecated version in Affine2D.__array__. This will force to use Transform.get_affine() whereever necessary, thus making the dropping of the nonlinear part more obvious.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions