Don't use PyLong_FromLong

This changes gdb to avoid PyLong_FromLong, preferring to
gdb_py_object_from_longest instead.

gdb/ChangeLog
2020-09-15  Tom Tromey  <tromey@adacore.com>

	* python/python.c (gdbpy_parameter_value): Use
	gdb_py_object_from_longest.
	* python/py-type.c (convert_field, typy_range): Use
	gdb_py_object_from_longest.
	* python/py-tui.c (gdbpy_tui_width, gdbpy_tui_height): Use
	gdb_py_object_from_longest.
	* python/py-lazy-string.c (stpy_get_length): Use
	gdb_py_object_from_longest.
	* python/py-infthread.c (thpy_get_num, thpy_get_global_num): Use
	gdb_py_object_from_longest.
	* python/py-infevents.c (create_memory_changed_event_object): Use
	gdb_py_object_from_longest.
	* python/py-inferior.c (infpy_get_num): Use
	gdb_py_object_from_longest.
	(infpy_get_pid): Likewise.
This commit is contained in:
Tom Tromey
2020-09-15 11:08:56 -06:00
parent d1cab9876d
commit 062534d44f
8 changed files with 38 additions and 12 deletions

View File

@ -233,7 +233,7 @@ convert_field (struct type *type, int field)
if (PyObject_SetAttrString (result.get (), "is_base_class", arg.get ()) < 0)
return NULL;
arg.reset (PyLong_FromLong (TYPE_FIELD_BITSIZE (type, field)));
arg = gdb_py_object_from_longest (TYPE_FIELD_BITSIZE (type, field));
if (arg == NULL)
return NULL;
if (PyObject_SetAttrString (result.get (), "bitsize", arg.get ()) < 0)
@ -596,11 +596,11 @@ typy_range (PyObject *self, PyObject *args)
break;
}
gdbpy_ref<> low_bound (PyLong_FromLong (low));
gdbpy_ref<> low_bound = gdb_py_object_from_longest (low);
if (low_bound == NULL)
return NULL;
gdbpy_ref<> high_bound (PyLong_FromLong (high));
gdbpy_ref<> high_bound = gdb_py_object_from_longest (high);
if (high_bound == NULL)
return NULL;