[3/5] Simplify gdbpy_stop_recording

Message ID 20181227192637.17862-4-tom@tromey.com
State New
Headers show
Series
  • Reference counting improvements in Python
Related show

Commit Message

Tom Tromey Dec. 27, 2018, 7:26 p.m.
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.

2018-12-27  Tom Tromey  <tom@tromey.com>

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

-- 
2.17.2

Patch

diff --git a/gdb/python/py-record.c b/gdb/python/py-record.c
index b203786473..4b5de40f3e 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;
 }