aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-param.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2022-03-21 10:07:41 -0400
committerSimon Marchi <simon.marchi@efficios.com>2022-03-23 07:42:57 -0400
commit5aee45879681a7a76754a25b3f4f96b4529f7ae3 (patch)
tree04698477d38cf45871c7542eea6ce6a8d2b46a18 /gdb/python/py-param.c
parentedae3fd6600f10f9e16dc017b705959f541ed19a (diff)
downloadbinutils-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-param.c')
-rw-r--r--gdb/python/py-param.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c
index 6be771c..d0dd2a9 100644
--- a/gdb/python/py-param.c
+++ b/gdb/python/py-param.c
@@ -125,7 +125,7 @@ static PyObject *show_doc_cst;
static PyObject *
get_attr (PyObject *obj, PyObject *attr_name)
{
- if (PyString_Check (attr_name)
+ if (PyUnicode_Check (attr_name)
&& ! PyUnicode_CompareWithASCIIString (attr_name, "value"))
{
parmpy_object *self = (parmpy_object *) obj;
@@ -243,7 +243,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
long l;
int ok;
- if (! PyInt_Check (value))
+ if (!PyLong_Check (value))
{
PyErr_SetString (PyExc_RuntimeError,
_("The value must be integer."));
@@ -308,7 +308,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
static int
set_attr (PyObject *obj, PyObject *attr_name, PyObject *val)
{
- if (PyString_Check (attr_name)
+ if (PyUnicode_Check (attr_name)
&& ! PyUnicode_CompareWithASCIIString (attr_name, "value"))
{
if (!val)
@@ -447,7 +447,7 @@ get_set_value (const char *args, int from_tty,
gdb::unique_xmalloc_ptr<char> set_doc_string;
gdbpy_enter enter_py;
- gdbpy_ref<> set_doc_func (PyString_FromString ("get_set_string"));
+ gdbpy_ref<> set_doc_func (PyUnicode_FromString ("get_set_string"));
if (set_doc_func == NULL)
{
@@ -482,7 +482,7 @@ get_show_value (struct ui_file *file, int from_tty,
gdb::unique_xmalloc_ptr<char> show_doc_string;
gdbpy_enter enter_py;
- gdbpy_ref<> show_doc_func (PyString_FromString ("get_show_string"));
+ gdbpy_ref<> show_doc_func (PyUnicode_FromString ("get_show_string"));
if (show_doc_func == NULL)
{
@@ -492,7 +492,7 @@ get_show_value (struct ui_file *file, int from_tty,
if (PyObject_HasAttr (obj, show_doc_func.get ()))
{
- gdbpy_ref<> val_obj (PyString_FromString (value));
+ gdbpy_ref<> val_obj (PyUnicode_FromString (value));
if (val_obj == NULL)
{
@@ -835,10 +835,10 @@ gdbpy_initialize_parameters (void)
if (PyType_Ready (&parmpy_object_type) < 0)
return -1;
- set_doc_cst = PyString_FromString ("set_doc");
+ set_doc_cst = PyUnicode_FromString ("set_doc");
if (! set_doc_cst)
return -1;
- show_doc_cst = PyString_FromString ("show_doc");
+ show_doc_cst = PyUnicode_FromString ("show_doc");
if (! show_doc_cst)
return -1;