diff --git a/lldb/scripts/Python/python-typemaps.swig b/lldb/scripts/Python/python-typemaps.swig index 0eca5ea3778f..d272ea3e4cd8 100644 --- a/lldb/scripts/Python/python-typemaps.swig +++ b/lldb/scripts/Python/python-typemaps.swig @@ -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 +}