From 12ce07a2c226769f7b1370789ad2a28ff548baa2 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Wed, 14 Dec 2016 01:43:06 -0500 Subject: [PATCH] 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. --- include/pybind11/cast.h | 24 ++++++++++++------------ include/pybind11/pybind11.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index ed61c10f8..7e78d7b23 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -1227,8 +1227,8 @@ public: static PYBIND11_DESCR arg_names() { return detail::concat(make_caster::name()...); } - bool load_args(handle args, handle kwargs, bool convert) { - return load_impl(args, kwargs, convert, itypes{}); + bool load_args(handle args, handle kwargs) { + return load_impl(args, kwargs, itypes{}); } template @@ -1243,26 +1243,26 @@ public: } private: - bool load_impl(handle args_, handle, bool convert, type_list) { - std::get<0>(value).load(args_, convert); + bool load_impl(handle args_, handle, type_list) { + std::get<0>(value).load(args_, true); return true; } - bool load_impl(handle args_, handle kwargs_, bool convert, type_list) { - std::get<0>(value).load(args_, convert); - std::get<1>(value).load(kwargs_, convert); + bool load_impl(handle args_, handle kwargs_, type_list) { + std::get<0>(value).load(args_, true); + std::get<1>(value).load(kwargs_, true); return true; } - bool load_impl(handle args, handle, bool convert, ... /* anything else */) { - return load_impl_sequence(args, convert, indices{}); + bool load_impl(handle args, handle, ... /* anything else */) { + 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 - bool load_impl_sequence(handle src, bool convert, index_sequence) { - for (bool r : {std::get(value).load(PyTuple_GET_ITEM(src.ptr(), Is), convert)...}) + bool load_impl_sequence(handle src, index_sequence) { + for (bool r : {std::get(value).load(PyTuple_GET_ITEM(src.ptr(), Is), true)...}) if (!r) return false; return true; diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 1db9efb8c..6c884a860 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -121,7 +121,7 @@ protected: cast_in args_converter; /* 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; /* Invoke call policy pre-call hook */