diff options
author | Filipe Cabecinhas <me@filcab.net> | 2012-05-11 20:38:28 +0000 |
---|---|---|
committer | Filipe Cabecinhas <me@filcab.net> | 2012-05-11 20:38:28 +0000 |
commit | 0bfed4bc7aa3e05389fa8844cb0c9e8a37c6e65b (patch) | |
tree | 11cad6de1187965ae6f7d10d0df47da18aeb0fa2 /lldb/scripts/Python | |
parent | 0c543ea186296616f635be8ca84fb252f92ede5b (diff) | |
download | bcm5719-llvm-0bfed4bc7aa3e05389fa8844cb0c9e8a37c6e65b.tar.gz bcm5719-llvm-0bfed4bc7aa3e05389fa8844cb0c9e8a37c6e65b.zip |
Fix SBProcess::ReadMemory's typemap to handle PyLongObjects.
llvm-svn: 156638
Diffstat (limited to 'lldb/scripts/Python')
-rw-r--r-- | lldb/scripts/Python/python-typemaps.swig | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lldb/scripts/Python/python-typemaps.swig b/lldb/scripts/Python/python-typemaps.swig index 0eca5ea3778..d272ea3e4cd 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 +} |