Merge branch 'master' into bakein

This commit is contained in:
Ralf W. Grosse-Kunstleve 2024-07-01 21:51:36 -07:00
commit b0cfeec63c
3 changed files with 10 additions and 1 deletions

View File

@ -102,7 +102,7 @@ jobs:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
- name: Generate artifact attestation for sdist and wheel - name: Generate artifact attestation for sdist and wheel
uses: actions/attest-build-provenance@173725a1209d09b31f9d30a3890cf2757ebbff0d # v1.1.2 uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
with: with:
subject-path: "*/pybind11*" subject-path: "*/pybind11*"

View File

@ -741,6 +741,13 @@ class type_caster<std::pair<T1, T2>> : public tuple_caster<std::pair, T1, T2> {}
template <typename... Ts> template <typename... Ts>
class type_caster<std::tuple<Ts...>> : public tuple_caster<std::tuple, Ts...> {}; class type_caster<std::tuple<Ts...>> : public tuple_caster<std::tuple, Ts...> {};
template <>
class type_caster<std::tuple<>> : public tuple_caster<std::tuple> {
public:
// PEP 484 specifies this syntax for an empty tuple
static constexpr auto name = const_name("tuple[()]");
};
/// Helper class which abstracts away certain actions. Users can provide specializations for /// Helper class which abstracts away certain actions. Users can provide specializations for
/// custom holders, but it's only necessary if the type has a non-standard interface. /// custom holders, but it's only necessary if the type has a non-standard interface.
template <typename T> template <typename T>

View File

@ -368,6 +368,8 @@ def test_tuple(doc):
""" """
) )
assert doc(m.empty_tuple) == """empty_tuple() -> tuple[()]"""
assert m.rvalue_pair() == ("rvalue", "rvalue") assert m.rvalue_pair() == ("rvalue", "rvalue")
assert m.lvalue_pair() == ("lvalue", "lvalue") assert m.lvalue_pair() == ("lvalue", "lvalue")
assert m.rvalue_tuple() == ("rvalue", "rvalue", "rvalue") assert m.rvalue_tuple() == ("rvalue", "rvalue", "rvalue")