[binutils-gdb] Simplify gdbpy_stop_recording

Tom Tromey tromey@sourceware.org
Thu Jan 3 22:38:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ea41325b7d134e91648e340d8297e8f6ee5fe26a

commit ea41325b7d134e91648e340d8297e8f6ee5fe26a
Author: Tom Tromey <tom@tromey.com>
Date:   Thu Dec 27 11:57:28 2018 -0700

    Simplify gdbpy_stop_recording
    
    This simplifies gdbpy_stop_recording, by having it use Py_RETURN_NONE
    rather than writing it out manually, and by usin the idiomatic
    GDB_PY_HANDLE_EXCEPTION.
    
    gdb/ChangeLog
    2019-01-03  Tom Tromey  <tom@tromey.com>
    
    	* python/py-record.c (gdbpy_stop_recording): Use Py_RETURN_NONE.

Diff:
---
 gdb/ChangeLog          | 4 ++++
 gdb/python/py-record.c | 8 ++------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a01c149..6ed1545 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2019-01-03  Tom Tromey  <tom@tromey.com>
 
+	* python/py-record.c (gdbpy_stop_recording): Use Py_RETURN_NONE.
+
+2019-01-03  Tom Tromey  <tom@tromey.com>
+
 	* python/py-value.c (valpy_dealloc): Use Py_XDECREF.
 	* python/py-type.c (typy_fields_items): Use gdbpy_ref.
 	* python/py-progspace.c (pspy_set_printers): Use gdbpy_ref.
diff --git a/gdb/python/py-record.c b/gdb/python/py-record.c
index 3d638e5..e818560 100644
--- a/gdb/python/py-record.c
+++ b/gdb/python/py-record.c
@@ -638,19 +638,15 @@ gdbpy_current_recording (PyObject *self, PyObject *args)
 PyObject *
 gdbpy_stop_recording (PyObject *self, PyObject *args)
 {
-  PyObject *ret = NULL;
-
   TRY
     {
       record_stop (0);
-      ret = Py_None;
-      Py_INCREF (Py_None);
     }
   CATCH (except, RETURN_MASK_ALL)
     {
-      gdbpy_convert_exception (except);
+      GDB_PY_HANDLE_EXCEPTION (except);
     }
   END_CATCH
 
-  return ret;
+  Py_RETURN_NONE;
 }



More information about the Gdb-cvs mailing list