Skip to content

Commit 9d95a19

Browse files
fix: don't fallback to Python callbacks if CPPOverload or TemplateProxy (#143)
* fix: don't fallback to Python callbacks if CPPOverload or TemplateProxy * Apply suggestions from code review Co-authored-by: Vassil Vassilev <[email protected]> --------- Co-authored-by: Vassil Vassilev <[email protected]>
1 parent 4d504ce commit 9d95a19

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Converters.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,14 +2650,17 @@ static void* PyFunction_AsCPointer(PyObject* pyobject,
26502650
// find the overload with matching signature
26512651
for (auto& m : ol->fMethodInfo->fMethods) {
26522652
PyObject* sig = m->GetSignature(false);
2653-
bool found = signature == CPyCppyy_PyText_AsString(sig);
2653+
bool found = true_signature == CPyCppyy_PyText_AsString(sig);
26542654
Py_DECREF(sig);
26552655
if (found) {
26562656
void* fptr = (void*)m->GetFunctionAddress();
26572657
if (fptr) return fptr;
26582658
break; // fall-through, with calling through Python
26592659
}
26602660
}
2661+
// FIXME: maybe we should try BestOverloadFunctionMatch before failing
2662+
// FIXME: Should we fall-through, with calling through Python
2663+
return nullptr;
26612664
}
26622665

26632666
if (TemplateProxy_Check(pyobject)) {
@@ -2672,7 +2675,8 @@ static void* PyFunction_AsCPointer(PyObject* pyobject,
26722675
void* fptr = (void*)Cppyy::GetFunctionAddress(cppmeth, false);
26732676
if (fptr) return fptr;
26742677
}
2675-
// fall-through, with calling through Python
2678+
// FIXME: Should we fall-through, with calling through Python
2679+
return nullptr;
26762680
}
26772681

26782682
if (PyObject_IsInstance(pyobject, (PyObject*)GetCTypesType(ct_c_funcptr))) {

0 commit comments

Comments
 (0)