Skip to content

TYP: Relax the type of ndarray.__array_finalize__#20768

Merged
charris merged 1 commit intonumpy:maintenance/1.22.xfrom
BvB93:finalize4
Jan 8, 2022
Merged

TYP: Relax the type of ndarray.__array_finalize__#20768
charris merged 1 commit intonumpy:maintenance/1.22.xfrom
BvB93:finalize4

Conversation

@BvB93
Copy link
Copy Markdown
Member

@BvB93 BvB93 commented Jan 8, 2022

Closes #20756
Xref #20717

Changes the default type of the ndarray.__array_finalize__ attribute from None to Any, this allowing subclasses to overwrite it with a method (without mypy complaining, that is). This is not the most ideal solution, but #20717 (comment) currently doesn't work due to what appears to be a mypy bug.

Note that this is a 1.22.1-exclusive PR, as the concernes addressed above are irrelevant once #20766 is merged.

@BvB93 BvB93 added this to the 1.22.1 release milestone Jan 8, 2022
@BvB93 BvB93 linked an issue Jan 8, 2022 that may be closed by this pull request
@charris charris merged commit 8f87be6 into numpy:maintenance/1.22.x Jan 8, 2022
@charris
Copy link
Copy Markdown
Member

charris commented Jan 8, 2022

Thanks Bas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TYP: incorrect array_finalize definition in ndarray for subclassing

2 participants