aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-xmethods.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-xmethods.c')
-rw-r--r--gdb/python/py-xmethods.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/gdb/python/py-xmethods.c b/gdb/python/py-xmethods.c
index f4947ab..eab69a0 100644
--- a/gdb/python/py-xmethods.c
+++ b/gdb/python/py-xmethods.c
@@ -52,18 +52,15 @@ gdbpy_free_xmethod_worker_data (const struct extension_language_defn *extlang,
void *data)
{
struct gdbpy_worker_data *worker_data = (struct gdbpy_worker_data *) data;
- struct cleanup *cleanups;
gdb_assert (worker_data->worker != NULL && worker_data->this_type != NULL);
/* We don't do much here, but we still need the GIL. */
- cleanups = ensure_python_env (get_current_arch (), current_language);
+ gdbpy_enter enter_py (get_current_arch (), current_language);
Py_DECREF (worker_data->worker);
Py_DECREF (worker_data->this_type);
xfree (worker_data);
-
- do_cleanups (cleanups);
}
/* Implementation of clone_xmethod_worker_data for Python. */
@@ -74,12 +71,11 @@ gdbpy_clone_xmethod_worker_data (const struct extension_language_defn *extlang,
{
struct gdbpy_worker_data *worker_data
= (struct gdbpy_worker_data *) data, *new_data;
- struct cleanup *cleanups;
gdb_assert (worker_data->worker != NULL && worker_data->this_type != NULL);
/* We don't do much here, but we still need the GIL. */
- cleanups = ensure_python_env (get_current_arch (), current_language);
+ gdbpy_enter enter_py (get_current_arch (), current_language);
new_data = XCNEW (struct gdbpy_worker_data);
new_data->worker = worker_data->worker;
@@ -87,8 +83,6 @@ gdbpy_clone_xmethod_worker_data (const struct extension_language_defn *extlang,
Py_INCREF (new_data->worker);
Py_INCREF (new_data->this_type);
- do_cleanups (cleanups);
-
return new_data;
}