diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2022-03-21 10:07:41 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2022-03-23 07:42:57 -0400 |
commit | 5aee45879681a7a76754a25b3f4f96b4529f7ae3 (patch) | |
tree | 04698477d38cf45871c7542eea6ce6a8d2b46a18 /gdb/python/py-cmd.c | |
parent | edae3fd6600f10f9e16dc017b705959f541ed19a (diff) | |
download | binutils-5aee45879681a7a76754a25b3f4f96b4529f7ae3.zip binutils-5aee45879681a7a76754a25b3f4f96b4529f7ae3.tar.gz binutils-5aee45879681a7a76754a25b3f4f96b4529f7ae3.tar.bz2 |
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
Diffstat (limited to 'gdb/python/py-cmd.c')
-rw-r--r-- | gdb/python/py-cmd.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index b51b05c..c0a98544 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -233,7 +233,7 @@ cmdpy_completer_handle_brkchars (struct cmd_list_element *command, if (resultobj == NULL) return; - if (PyInt_Check (resultobj.get ())) + if (PyLong_Check (resultobj.get ())) { /* User code may also return one of the completion constants, thus requesting that sort of completion. We are only @@ -277,7 +277,7 @@ cmdpy_completer (struct cmd_list_element *command, if (resultobj == NULL) return; - if (PyInt_Check (resultobj.get ())) + if (PyLong_Check (resultobj.get ())) { /* User code may also return one of the completion constants, thus requesting that sort of completion. */ @@ -592,10 +592,10 @@ gdbpy_initialize_commands (void) (PyObject *) &cmdpy_object_type) < 0) return -1; - invoke_cst = PyString_FromString ("invoke"); + invoke_cst = PyUnicode_FromString ("invoke"); if (invoke_cst == NULL) return -1; - complete_cst = PyString_FromString ("complete"); + complete_cst = PyUnicode_FromString ("complete"); if (complete_cst == NULL) return -1; @@ -684,7 +684,7 @@ gdbpy_string_to_argv (PyObject *self, PyObject *args) for (char *arg : c_argv) { - gdbpy_ref<> argp (PyString_FromString (arg)); + gdbpy_ref<> argp (PyUnicode_FromString (arg)); if (argp == NULL || PyList_Append (py_argv.get (), argp.get ()) < 0) |