Fix Python 3 issues related to OS plugins.
* lldb::tid_t was being converted incorrectly, so this is updated to use PythonInteger instead of manual Python Native API calls. * OSPlugin_RegisterContextData was assuming that the result of get_register_data was a string, when in fact it is a bytes. So this method is updated to use PythonBytes to do the work. llvm-svn: 257398
This commit is contained in:
parent
5a72c02be9
commit
7a76845c48
|
@ -26,15 +26,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(in) lldb::tid_t {
|
%typemap(in) lldb::tid_t {
|
||||||
if (PyInt_Check($input))
|
using namespace lldb_private;
|
||||||
$1 = PyInt_AsLong($input);
|
if (PythonInteger::Check($input))
|
||||||
else if (PyLong_Check($input))
|
{
|
||||||
$1 = PyLong_AsLongLong($input);
|
PythonInteger py_int(PyRefType::Borrowed, $input);
|
||||||
else
|
$1 = static_cast<lldb::tid_t>(py_int.GetInteger());
|
||||||
{
|
}
|
||||||
PyErr_SetString(PyExc_ValueError, "Expecting an integer");
|
else
|
||||||
return NULL;
|
{
|
||||||
}
|
PyErr_SetString(PyExc_ValueError, "Expecting an integer");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(typecheck) char ** {
|
%typemap(typecheck) char ** {
|
||||||
|
|
|
@ -1692,10 +1692,10 @@ ScriptInterpreterPython::OSPlugin_RegisterContextData(StructuredData::ObjectSP o
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(PythonString::Check(py_return.get()) && "get_register_data returned unknown object type!");
|
assert(PythonBytes::Check(py_return.get()) && "get_register_data returned unknown object type!");
|
||||||
|
|
||||||
PythonString result_string(PyRefType::Borrowed, py_return.get());
|
PythonBytes result(PyRefType::Borrowed, py_return.get());
|
||||||
return result_string.CreateStructuredString();
|
return result.CreateStructuredString();
|
||||||
}
|
}
|
||||||
|
|
||||||
StructuredData::DictionarySP
|
StructuredData::DictionarySP
|
||||||
|
|
Loading…
Reference in New Issue