mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 14:49:38 +08:00
gdb/python: remove Python 2/3 compatibility macros
New in this version: - Rebase on master, fix a few more issues that appeared. python-internal.h contains a number of macros that helped make the code work with both Python 2 and 3. Remove them and adjust the code to use the Python 3 functions. Change-Id: I99a3d80067fb2d65de4f69f6473ba6ffd16efb2d
This commit is contained in:
@ -109,7 +109,7 @@ archpy_name (PyObject *self, PyObject *args)
|
||||
ARCHPY_REQUIRE_VALID (self, gdbarch);
|
||||
|
||||
name = (gdbarch_bfd_arch_info (gdbarch))->printable_name;
|
||||
return PyString_FromString (name);
|
||||
return PyUnicode_FromString (name);
|
||||
}
|
||||
|
||||
/* Implementation of
|
||||
@ -167,7 +167,7 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
|
||||
}
|
||||
if (count_obj)
|
||||
{
|
||||
count = PyInt_AsLong (count_obj);
|
||||
count = PyLong_AsLong (count_obj);
|
||||
if (PyErr_Occurred () || count < 0)
|
||||
{
|
||||
PyErr_SetString (PyExc_TypeError,
|
||||
@ -216,9 +216,8 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
|
||||
if (pc_obj == nullptr)
|
||||
return nullptr;
|
||||
|
||||
gdbpy_ref<> asm_obj (PyString_FromString (!stb.empty ()
|
||||
? stb.c_str ()
|
||||
: "<unknown>"));
|
||||
gdbpy_ref<> asm_obj
|
||||
(PyUnicode_FromString (!stb.empty () ? stb.c_str () : "<unknown>"));
|
||||
if (asm_obj == nullptr)
|
||||
return nullptr;
|
||||
|
||||
@ -341,7 +340,7 @@ gdbpy_all_architecture_names (PyObject *self, PyObject *args)
|
||||
std::vector<const char *> name_list = gdbarch_printable_names ();
|
||||
for (const char *name : name_list)
|
||||
{
|
||||
gdbpy_ref <> py_name (PyString_FromString (name));
|
||||
gdbpy_ref <> py_name (PyUnicode_FromString (name));
|
||||
if (py_name == nullptr)
|
||||
return nullptr;
|
||||
if (PyList_Append (list.get (), py_name.get ()) < 0)
|
||||
|
Reference in New Issue
Block a user