[Lldb-commits] [lldb] r156638 - /lldb/trunk/scripts/Python/python-typemaps.swig

Filipe Cabecinhas me at filcab.net
Fri May 11 13:38:28 PDT 2012


Author: filcab
Date: Fri May 11 15:38:28 2012
New Revision: 156638

URL: http://llvm.org/viewvc/llvm-project?rev=156638&view=rev
Log:
Fix SBProcess::ReadMemory's typemap to handle PyLongObjects.

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=156638&r1=156637&r2=156638&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/python-typemaps.swig (original)
+++ lldb/trunk/scripts/Python/python-typemaps.swig Fri May 11 15:38:28 2012
@@ -116,11 +116,14 @@
 // typemap for an incoming buffer
 // See also SBProcess::ReadMemory.
 %typemap(in) (void *buf, size_t size) {
-   if (!PyInt_Check($input)) {
-       PyErr_SetString(PyExc_ValueError, "Expecting an integer");
-       return NULL;
+   if (PyInt_Check($input)) {
+      $2 = PyInt_AsLong($input);
+   } else if (PyLong_Check($input)) {
+      $2 = PyLong_AsLong($input);
+   } else {
+      PyErr_SetString(PyExc_ValueError, "Expecting an integer or long object");
+      return NULL;
    }
-   $2 = PyInt_AsLong($input);
    if ($2 <= 0) {
        PyErr_SetString(PyExc_ValueError, "Positive integer expected");
        return NULL;
@@ -329,4 +332,4 @@
 
 %typemap(freearg) (uint32_t *versions) {
     free($1);
-}
\ No newline at end of file
+}





More information about the lldb-commits mailing list