Commit 12ce07a2 by Jason Rhinelander Committed by Wenzel Jakob

Remove useless `convert` argument from argument_loader

Since the argument loader split off from the tuple converter, it is
never called with a `convert` argument set to anything but true.  This
removes the argument entirely, passing a literal `true` from within
`argument_loader` to the individual value casters.
parent 23e59c86
...@@ -1227,8 +1227,8 @@ public: ...@@ -1227,8 +1227,8 @@ public:
static PYBIND11_DESCR arg_names() { return detail::concat(make_caster<Args>::name()...); } static PYBIND11_DESCR arg_names() { return detail::concat(make_caster<Args>::name()...); }
bool load_args(handle args, handle kwargs, bool convert) { bool load_args(handle args, handle kwargs) {
return load_impl(args, kwargs, convert, itypes{}); return load_impl(args, kwargs, itypes{});
} }
template <typename Return, typename Func> template <typename Return, typename Func>
...@@ -1243,26 +1243,26 @@ public: ...@@ -1243,26 +1243,26 @@ public:
} }
private: private:
bool load_impl(handle args_, handle, bool convert, type_list<args>) { bool load_impl(handle args_, handle, type_list<args>) {
std::get<0>(value).load(args_, convert); std::get<0>(value).load(args_, true);
return true; return true;
} }
bool load_impl(handle args_, handle kwargs_, bool convert, type_list<args, kwargs>) { bool load_impl(handle args_, handle kwargs_, type_list<args, kwargs>) {
std::get<0>(value).load(args_, convert); std::get<0>(value).load(args_, true);
std::get<1>(value).load(kwargs_, convert); std::get<1>(value).load(kwargs_, true);
return true; return true;
} }
bool load_impl(handle args, handle, bool convert, ... /* anything else */) { bool load_impl(handle args, handle, ... /* anything else */) {
return load_impl_sequence(args, convert, indices{}); return load_impl_sequence(args, indices{});
} }
static constexpr bool load_impl_sequence(handle, bool, index_sequence<>) { return true; } static constexpr bool load_impl_sequence(handle, index_sequence<>) { return true; }
template <size_t... Is> template <size_t... Is>
bool load_impl_sequence(handle src, bool convert, index_sequence<Is...>) { bool load_impl_sequence(handle src, index_sequence<Is...>) {
for (bool r : {std::get<Is>(value).load(PyTuple_GET_ITEM(src.ptr(), Is), convert)...}) for (bool r : {std::get<Is>(value).load(PyTuple_GET_ITEM(src.ptr(), Is), true)...})
if (!r) if (!r)
return false; return false;
return true; return true;
......
...@@ -121,7 +121,7 @@ protected: ...@@ -121,7 +121,7 @@ protected:
cast_in args_converter; cast_in args_converter;
/* Try to cast the function arguments into the C++ domain */ /* Try to cast the function arguments into the C++ domain */
if (!args_converter.load_args(args, kwargs, true)) if (!args_converter.load_args(args, kwargs))
return PYBIND11_TRY_NEXT_OVERLOAD; return PYBIND11_TRY_NEXT_OVERLOAD;
/* Invoke call policy pre-call hook */ /* Invoke call policy pre-call hook */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment