mirror of
https://github.com/pybind/pybind11.git
synced 2026-05-24 23:07:00 +00:00
Allow subclasses of py::args and py::kwargs (#5381)
* Allow subclasses of py::args and py::kwargs The current implementation does not allow subclasses of args or kwargs. This change allows subclasses to be used. * Added test case * style: pre-commit fixes * Added missing semi-colons * style: pre-commit fixes * Added handle_type_name * Moved classes outside of function * Added namespaces * style: pre-commit fixes * Refactored tests Added more tests and moved tests to more appropriate locations. * style: pre-commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1570,9 +1570,9 @@ class argument_loader {
|
||||
using indices = make_index_sequence<sizeof...(Args)>;
|
||||
|
||||
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>
|
||||
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:
|
||||
static constexpr auto kwargs_pos = constexpr_last<argument_is_kwargs, Args...>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user