Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class ScriptedPythonInterface : virtual public ScriptedInterface {
if (!class_dict.HasKey(method_name))
SET_CASE_AND_CONTINUE(method_name,
AbstractMethodCheckerCases::eNotImplemented)
auto callable_or_err = class_dict.GetItem(method_name);
llvm::Expected<PythonObject> callable_or_err =
class_dict.GetItem(method_name);
if (!callable_or_err) {
llvm::consumeError(callable_or_err.takeError());
SET_CASE_AND_CONTINUE(method_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,17 @@ bool PythonCallable::Check(PyObject *py_obj) {
if (!py_obj)
return false;

PythonObject python_obj(PyRefType::Borrowed, py_obj);

// Handle staticmethod/classmethod descriptors by extracting the
// `__func__` attribute.
if (python_obj.HasAttribute("__func__")) {
PythonObject function_obj = python_obj.GetAttributeValue("__func__");
if (!function_obj.IsAllocated())
return false;
return PyCallable_Check(function_obj.release());
}

return PyCallable_Check(py_obj);
}

Expand Down
Loading