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.
This commit is contained in:
Jason Rhinelander 2016-12-14 01:43:06 -05:00 committed by Wenzel Jakob
parent 23e59c8633
commit 12ce07a2c2
2 changed files with 13 additions and 13 deletions

View File

@ -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:
} }
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;

View File

@ -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 */