Merge branch 'pybind:master' into master

This commit is contained in:
Steve R. Sun 2023-05-26 09:12:40 +08:00 committed by GitHub
commit b7185b4198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -273,11 +273,11 @@ public:
}
PYBIND11_TYPE_CASTER(ArrayType,
const_name("List[") + value_conv::name
const_name<Resizable>(const_name(""), const_name("Annotated["))
+ const_name("List[") + value_conv::name + const_name("]")
+ const_name<Resizable>(const_name(""),
const_name("[") + const_name<Size>()
+ const_name("]"))
+ const_name("]"));
const_name(", FixedSize(")
+ const_name<Size>() + const_name(")]")));
};
template <typename Type, size_t Size>

View File

@ -39,8 +39,11 @@ def test_array(doc):
assert m.load_array(lst)
assert m.load_array(tuple(lst))
assert doc(m.cast_array) == "cast_array() -> List[int[2]]"
assert doc(m.load_array) == "load_array(arg0: List[int[2]]) -> bool"
assert doc(m.cast_array) == "cast_array() -> Annotated[List[int], FixedSize(2)]"
assert (
doc(m.load_array)
== "load_array(arg0: Annotated[List[int], FixedSize(2)]) -> bool"
)
def test_valarray(doc):