forked from OSchip/llvm-project
Fix SBProcess::ReadMemory's typemap to handle PyLongObjects.
llvm-svn: 156638
This commit is contained in:
parent
0c543ea186
commit
0bfed4bc7a
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue