diff options
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp index fedd8f6..1862bbd 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -887,6 +887,23 @@ void PythonCallable::Reset(PyRefType type, PyObject *py_obj) { PythonObject::Reset(PyRefType::Borrowed, result.get()); } +PythonCallable::ArgInfo PythonCallable::GetNumInitArguments() const { + ArgInfo result = {0, false, false, false}; + if (!IsValid()) + return result; + PyObject *py_func_obj = m_py_obj; + if (!PyClass_Check(m_py_obj)) + return result; + + PythonObject __init__ = GetAttributeValue("__init__"); + if (__init__.IsValid() ) { + auto __init_callable__ = __init__.AsType<PythonCallable>(); + if (__init_callable__.IsValid()) + return __init_callable__.GetNumArguments(); + } + return result; +} + PythonCallable::ArgInfo PythonCallable::GetNumArguments() const { ArgInfo result = {0, false, false, false}; if (!IsValid()) |