Skip to content

MAINT: Relax certain integer-type constraints#18887

Merged
charris merged 6 commits intonumpy:maintenance/1.20.xfrom
BvB93:supports_index
May 3, 2021
Merged

MAINT: Relax certain integer-type constraints#18887
charris merged 6 commits intonumpy:maintenance/1.20.xfrom
BvB93:supports_index

Conversation

@BvB93
Copy link
Copy Markdown
Member

@BvB93 BvB93 commented May 2, 2021

Backport of #18778 and #18800.

As was noted in scipy/scipy#13833 (comment) the definition of npt._ShapeLike (and certain integer-related
types in general) were to strict prior to aforementioned backports.

The latter currently demands a builtins.int (or a sequence thereof) while the likes of np.integer or,
more generally, objects implementing the __index__ protocol are generally suitable alternatives.

@BvB93 BvB93 added this to the 1.20.3 release milestone May 2, 2021
@BvB93 BvB93 force-pushed the supports_index branch from fc5cd21 to 342e9bd Compare May 2, 2021 22:23
Mypy 0.790 does not yet contain annotations for `typing_extensions.SupportsIndex`, so we'll have to define them ourselves
@charris charris merged commit 55a5668 into numpy:maintenance/1.20.x May 3, 2021
@charris
Copy link
Copy Markdown
Member

charris commented May 3, 2021

Thanks Bas.

@BvB93 BvB93 deleted the supports_index branch May 5, 2021 01:08
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.

2 participants