Use gdbpy_enter in py-progspace.c
authorTom Tromey <tom@tromey.com>
Mon, 7 Nov 2016 23:08:36 +0000 (16:08 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 11 Jan 2017 02:13:42 +0000 (19:13 -0700)
Change py-progspace.c to use gdbpy_enter.

2017-01-10  Tom Tromey  <tom@tromey.com>

* python/py-progspace.c (py_free_pspace): Use gdbpy_enter.

gdb/ChangeLog
gdb/python/py-progspace.c

index 9062025..ddc6578 100644 (file)
@@ -1,5 +1,9 @@
 2017-01-10  Tom Tromey  <tom@tromey.com>
 
+       * python/py-progspace.c (py_free_pspace): Use gdbpy_enter.
+
+2017-01-10  Tom Tromey  <tom@tromey.com>
+
        * python/py-objfile.c (py_free_objfile): Use gdbpy_enter.
 
 2017-01-10  Tom Tromey  <tom@tromey.com>
index a9ea82b..b0d9458 100644 (file)
@@ -323,7 +323,6 @@ pspy_set_type_printers (PyObject *o, PyObject *value, void *ignore)
 static void
 py_free_pspace (struct program_space *pspace, void *datum)
 {
-  struct cleanup *cleanup;
   pspace_object *object = (pspace_object *) datum;
   /* This is a fiction, but we're in a nasty spot: The pspace is in the
      process of being deleted, we can't rely on anything in it.  Plus
@@ -336,10 +335,9 @@ py_free_pspace (struct program_space *pspace, void *datum)
      being deleted.  */
   struct gdbarch *arch = target_gdbarch ();
 
-  cleanup = ensure_python_env (arch, current_language);
+  gdbpy_enter enter_py (arch, current_language);
   object->pspace = NULL;
   Py_DECREF ((PyObject *) object);
-  do_cleanups (cleanup);
 }
 
 /* Return a borrowed reference to the Python object of type Pspace