-
Notifications
You must be signed in to change notification settings - Fork 47
Closed
Description
@asmeurer noted in #110 (comment) that NumPy proper (i.e. numpy, as opposed to numpy.array_api) wasn't working with the test suite due to the following code. The problem was that the dtype attribute of NumPy-proper arrays were being used in conjuction with namespaced dtypes—these two are different objects, and thus have different hashes so they look like different keys in a dict.
>>> import numpy as np
>>> dtypes_map = {np.int64: "foo"}
>>> dtypes_map[np.asarray(0).dtype]
KeyErrorThis behaviour is isn't specifically ruled out in the spec, as the spec only says dtypes need equality, which NumPy-proper does conform to.
>>> np.asarray(0).dtype == np.int64
TrueSo the test suite should phase out assumptions of namespaced dtypes and array dtypes sharing the same hash, instead relying on equality.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels