Skip to content

Allow __dlpack__ to work with newer versions of NumPy#86

Merged
asmeurer merged 4 commits intodata-apis:mainfrom
asmeurer:dlpack-fix
Nov 8, 2024
Merged

Allow __dlpack__ to work with newer versions of NumPy#86
asmeurer merged 4 commits intodata-apis:mainfrom
asmeurer:dlpack-fix

Conversation

@asmeurer
Copy link
Member

@asmeurer asmeurer commented Nov 7, 2024

Fixes #85

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no suggestions.

raise NotImplementedError("The device argument to __dlpack__ is not yet implemented")
if copy not in [_default, None]:
raise NotImplementedError("The copy argument to __dlpack__ is not yet implemented")
if np.__version__[0] < '2.1':
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect:

>>> np.__version__
'2.1.3'
>>> np.__version__[0] < '2.1'
True

numpy.lib.NumpyVersion can be used here

@asmeurer
Copy link
Member Author

asmeurer commented Nov 8, 2024

I think I'm going to just drop NumPy 1.x support in a subsequent PR.

@asmeurer asmeurer merged commit f8e7c84 into data-apis:main Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The max_version argument to __dlpack__ is not yet implemented

3 participants