[Lldb-commits] [lldb] r246709 - We want Python int or long to both be usable as-a tid_t for API purposes. Introduce a typemap to this effect

Enrico Granata via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 2 13:53:44 PDT 2015


Author: enrico
Date: Wed Sep  2 15:53:43 2015
New Revision: 246709

URL: http://llvm.org/viewvc/llvm-project?rev=246709&view=rev
Log:
We want Python int or long to both be usable as-a tid_t for API purposes. Introduce a typemap to this effect

Modified:
    lldb/trunk/scripts/Python/python-typemaps.swig

Modified: lldb/trunk/scripts/Python/python-typemaps.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=246709&r1=246708&r2=246709&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/python-typemaps.swig (original)
+++ lldb/trunk/scripts/Python/python-typemaps.swig Wed Sep  2 15:53:43 2015
@@ -25,6 +25,18 @@
   }
 }
 
+%typemap(in) lldb::tid_t {
+    if (PyInt_Check($input))
+        $1 = PyInt_AsLong($input);
+    else if (PyLong_Check($input))
+        $1 = PyLong_AsLong($input);
+    else
+    {
+        PyErr_SetString(PyExc_ValueError, "Expecting an integer");
+        return NULL;
+    }
+}
+
 %typemap(typecheck) char ** {
   /* Check if is a list  */
   $1 = 1;




More information about the lldb-commits mailing list