Don't use PyInt_FromSsize_t
authorTom Tromey <tromey@adacore.com>
Tue, 15 Sep 2020 17:08:56 +0000 (11:08 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 15 Sep 2020 17:08:56 +0000 (11:08 -0600)
Change the Python layer to avoid PyInt_FromSsize_t, and remove the
compatibility define.

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

* python/python-internal.h (PyInt_FromSsize_t): Remove define.
* python/py-record.c (recpy_element_number): Use
gdb_py_object_from_longest.
(recpy_gap_number): Likewise.

gdb/ChangeLog
gdb/python/py-record.c
gdb/python/python-internal.h

index 74814165560920a3a7e67b665bfe4c0afc95daff..8a7ad2abe75fa80779d2153681b63b31a7ae837a 100644 (file)
@@ -1,3 +1,10 @@
+2020-09-15  Tom Tromey  <tromey@adacore.com>
+
+       * python/python-internal.h (PyInt_FromSsize_t): Remove define.
+       * python/py-record.c (recpy_element_number): Use
+       gdb_py_object_from_longest.
+       (recpy_gap_number): Likewise.
+
 2020-09-15  Tom Tromey  <tromey@adacore.com>
 
        * top.c (ui::ui): Update.
index a081ca942f30b609a89d4aee90658297f4d8329a..a6b08dcdd835a879ebee4ba925041d77e5e32594 100644 (file)
@@ -374,7 +374,7 @@ recpy_element_number (PyObject *self, void* closure)
 {
   const recpy_element_object * const obj = (recpy_element_object *) self;
 
-  return PyInt_FromSsize_t (obj->number);
+  return gdb_py_object_from_longest (obj->number).release ();
 }
 
 /* Implementation of RecordInstruction.__hash__ [int] and
@@ -454,7 +454,7 @@ recpy_gap_number (PyObject *self, void *closure)
 {
   const recpy_gap_object * const obj = (const recpy_gap_object *) self;
 
-  return PyInt_FromSsize_t (obj->number);
+  return gdb_py_object_from_longest (obj->number).release ();
 }
 
 /* Implementation of RecordGap.error_code [int].  */
index 6874543441bf548b4d9be9c7b77c659162fb41a9..e406f37533ec34c72f0e8415d01ae7028b12e7be 100644 (file)
@@ -97,7 +97,6 @@
 
 #define PyInt_Check PyLong_Check
 #define PyInt_FromLong PyLong_FromLong
-#define PyInt_FromSsize_t PyLong_FromSsize_t
 #define PyInt_AsLong PyLong_AsLong
 #define PyInt_AsSsize_t PyLong_AsSsize_t