summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/scripts/Python')
-rw-r--r--lldb/scripts/Python/python-wrapper.swig27
1 files changed, 26 insertions, 1 deletions
diff --git a/lldb/scripts/Python/python-wrapper.swig b/lldb/scripts/Python/python-wrapper.swig
index c3812df8110..0c6382482c3 100644
--- a/lldb/scripts/Python/python-wrapper.swig
+++ b/lldb/scripts/Python/python-wrapper.swig
@@ -105,7 +105,32 @@ FindSessionDictionary(const char *session_dictionary_name)
class PyCallable
{
public:
-
+ struct argc {
+ size_t num_args;
+ bool varargs : 1;
+ bool kwargs : 1;
+ };
+
+ argc
+ GetNumArguments ()
+ {
+ if (m_callable && PyFunction_Check(m_callable))
+ {
+ PyCodeObject* code = (PyCodeObject*)PyFunction_GET_CODE(m_callable);
+ if (code)
+ {
+ size_t args = code->co_argcount;
+ bool va=false,kw=false;
+ if ((code->co_flags & 4) == 4)
+ va = true;
+ if ((code->co_flags & 8) == 8)
+ kw = true;
+ return {args,va,kw};
+ }
+ }
+ return {SIZE_MAX,false,false};
+ }
+
operator
bool ()
{
OpenPOWER on IntegriCloud