mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 23:22:01 +00:00
Merge branch 'pybind:master' into master
This commit is contained in:
commit
366591a8d3
@ -719,7 +719,7 @@ protected:
|
|||||||
/* Iterator over the list of potentially admissible overloads */
|
/* Iterator over the list of potentially admissible overloads */
|
||||||
const function_record *overloads = reinterpret_cast<function_record *>(
|
const function_record *overloads = reinterpret_cast<function_record *>(
|
||||||
PyCapsule_GetPointer(self, get_function_record_capsule_name())),
|
PyCapsule_GetPointer(self, get_function_record_capsule_name())),
|
||||||
*it = overloads;
|
*current_overload = overloads;
|
||||||
assert(overloads != nullptr);
|
assert(overloads != nullptr);
|
||||||
|
|
||||||
/* Need to know how many arguments + keyword arguments there are to pick the right
|
/* Need to know how many arguments + keyword arguments there are to pick the right
|
||||||
@ -757,9 +757,10 @@ protected:
|
|||||||
std::vector<function_call> second_pass;
|
std::vector<function_call> second_pass;
|
||||||
|
|
||||||
// However, if there are no overloads, we can just skip the no-convert pass entirely
|
// However, if there are no overloads, we can just skip the no-convert pass entirely
|
||||||
const bool overloaded = it != nullptr && it->next != nullptr;
|
const bool overloaded
|
||||||
|
= current_overload != nullptr && current_overload->next != nullptr;
|
||||||
|
|
||||||
for (; it != nullptr; it = it->next) {
|
for (; current_overload != nullptr; current_overload = current_overload->next) {
|
||||||
|
|
||||||
/* For each overload:
|
/* For each overload:
|
||||||
1. Copy all positional arguments we were given, also checking to make sure that
|
1. Copy all positional arguments we were given, also checking to make sure that
|
||||||
@ -780,7 +781,7 @@ protected:
|
|||||||
a result other than PYBIND11_TRY_NEXT_OVERLOAD.
|
a result other than PYBIND11_TRY_NEXT_OVERLOAD.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const function_record &func = *it;
|
const function_record &func = *current_overload;
|
||||||
size_t num_args = func.nargs; // Number of positional arguments that we need
|
size_t num_args = func.nargs; // Number of positional arguments that we need
|
||||||
if (func.has_args) {
|
if (func.has_args) {
|
||||||
--num_args; // (but don't count py::args
|
--num_args; // (but don't count py::args
|
||||||
@ -1018,10 +1019,10 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result.ptr() != PYBIND11_TRY_NEXT_OVERLOAD) {
|
if (result.ptr() != PYBIND11_TRY_NEXT_OVERLOAD) {
|
||||||
// The error reporting logic below expects 'it' to be valid, as it would be
|
// The error reporting logic below expects 'current_overload' to be valid,
|
||||||
// if we'd encountered this failure in the first-pass loop.
|
// as it would be if we'd encountered this failure in the first-pass loop.
|
||||||
if (!result) {
|
if (!result) {
|
||||||
it = &call.func;
|
current_overload = &call.func;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1168,7 +1169,8 @@ protected:
|
|||||||
if (!result) {
|
if (!result) {
|
||||||
std::string msg = "Unable to convert function return value to a "
|
std::string msg = "Unable to convert function return value to a "
|
||||||
"Python type! The signature was\n\t";
|
"Python type! The signature was\n\t";
|
||||||
msg += it->signature;
|
assert(current_overload != nullptr);
|
||||||
|
msg += current_overload->signature;
|
||||||
append_note_if_missing_header_is_suspected(msg);
|
append_note_if_missing_header_is_suspected(msg);
|
||||||
// Attach additional error info to the exception if supported
|
// Attach additional error info to the exception if supported
|
||||||
if (PyErr_Occurred()) {
|
if (PyErr_Occurred()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user