Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/pybind11/numpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,7 @@ struct npy_format_descriptor<
enable_if_t<is_same_ignoring_cvref<T, PyObject *>::value
|| ((std::is_same<T, handle>::value || std::is_same<T, object>::value)
&& sizeof(T) == sizeof(PyObject *))>> {
static constexpr auto name = const_name("object");
static constexpr auto name = const_name("numpy.object_");

static constexpr int value = npy_api::NPY_OBJECT_;

Expand Down
7 changes: 7 additions & 0 deletions tests/test_numpy_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,13 @@ def test_constructors():
assert results["array_t<double>"].dtype == np.float64


def test_array_object_type(doc):
assert (
doc(m.pass_array_object_return_as_list)
== "pass_array_object_return_as_list(arg0: typing.Annotated[numpy.typing.ArrayLike, numpy.object_]) -> list"
)


def test_overload_resolution(msg):
# Exact overload matches:
assert m.overloaded(np.array([1], dtype="float64")) == "double"
Expand Down
Loading