mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 08:03:55 +00:00
Merge 14dbbce6bd
into 1f8b4a7f1a
This commit is contained in:
commit
7775595943
@ -1010,11 +1010,19 @@ struct handle_type_name<weakref> {
|
|||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct handle_type_name<args> {
|
struct handle_type_name<args> {
|
||||||
static constexpr auto name = const_name("*args");
|
static constexpr auto name = const_name("*args: typing.Any");
|
||||||
|
};
|
||||||
|
template <typename T>
|
||||||
|
struct handle_type_name<Args<T>> {
|
||||||
|
static constexpr auto name = const_name("*args: ") + make_caster<T>::name;
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct handle_type_name<kwargs> {
|
struct handle_type_name<kwargs> {
|
||||||
static constexpr auto name = const_name("**kwargs");
|
static constexpr auto name = const_name("**kwargs: typing.Any");
|
||||||
|
};
|
||||||
|
template <typename T>
|
||||||
|
struct handle_type_name<KWArgs<T>> {
|
||||||
|
static constexpr auto name = const_name("**kwargs: ") + make_caster<T>::name;
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct handle_type_name<obj_attr_accessor> {
|
struct handle_type_name<obj_attr_accessor> {
|
||||||
@ -1570,9 +1578,9 @@ class argument_loader {
|
|||||||
using indices = make_index_sequence<sizeof...(Args)>;
|
using indices = make_index_sequence<sizeof...(Args)>;
|
||||||
|
|
||||||
template <typename Arg>
|
template <typename Arg>
|
||||||
using argument_is_args = std::is_same<intrinsic_t<Arg>, args>;
|
using argument_is_args = std::is_base_of<args, intrinsic_t<Arg>>;
|
||||||
template <typename Arg>
|
template <typename Arg>
|
||||||
using argument_is_kwargs = std::is_same<intrinsic_t<Arg>, kwargs>;
|
using argument_is_kwargs = std::is_base_of<kwargs, intrinsic_t<Arg>>;
|
||||||
// Get kwargs argument position, or -1 if not present:
|
// Get kwargs argument position, or -1 if not present:
|
||||||
static constexpr auto kwargs_pos = constexpr_last<argument_is_kwargs, Args...>();
|
static constexpr auto kwargs_pos = constexpr_last<argument_is_kwargs, Args...>();
|
||||||
|
|
||||||
|
@ -2216,6 +2216,16 @@ class kwargs : public dict {
|
|||||||
PYBIND11_OBJECT_DEFAULT(kwargs, dict, PyDict_Check)
|
PYBIND11_OBJECT_DEFAULT(kwargs, dict, PyDict_Check)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class Args : public args {
|
||||||
|
using args::args;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class KWArgs : public kwargs {
|
||||||
|
using kwargs::kwargs;
|
||||||
|
};
|
||||||
|
|
||||||
class anyset : public object {
|
class anyset : public object {
|
||||||
public:
|
public:
|
||||||
PYBIND11_OBJECT(anyset, object, PyAnySet_Check)
|
PYBIND11_OBJECT(anyset, object, PyAnySet_Check)
|
||||||
|
Loading…
Reference in New Issue
Block a user