Skip to content

Commit

Permalink
test io_name
Browse files Browse the repository at this point in the history
  • Loading branch information
InvincibleRMC committed Jan 25, 2025
1 parent bd8f2aa commit cbb4bca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/pybind11/numpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ inline numpy_internals &get_numpy_internals() {
PYBIND11_NOINLINE module_ import_numpy_core_submodule(const char *submodule_name) {
module_ numpy = module_::import("numpy");
str version_string = numpy.attr("__version__");

>
module_ numpy_lib = module_::import("numpy.lib");
object numpy_version = numpy_lib.attr("NumpyVersion")(version_string);
int major_version = numpy_version.attr("major").cast<int>();
Expand Down Expand Up @@ -1445,7 +1445,8 @@ struct pyobject_caster<array_t<T, ExtraFlags>> {
static handle cast(const handle &src, return_value_policy /* policy */, handle /* parent */) {
return src.inc_ref();
}
PYBIND11_TYPE_CASTER(type, handle_type_name<type>::name);
PYBIND11_TYPE_CASTER(type,
io_name(const_name("numpy.typing.ArrayLike]"), const_name("numpy.typing.NDArray[") + npy_format_descriptor<type>::name + const_name("]")));
};

template <typename T>
Expand Down

0 comments on commit cbb4bca

Please sign in to comment.