[pygobject] Remove pyglib_gil_state_ensure/pyglib_gil_state_release



commit c1ad1129b42c7938662422bb33990026572866d0
Author: Christoph Reiter <creiter src gnome org>
Date:   Tue Mar 21 20:23:13 2017 +0100

    Remove pyglib_gil_state_ensure/pyglib_gil_state_release
    
    Use PyGILState_Ensure/PyGILState_Release instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699440

 gi/gobjectmodule.c       |   40 ++++++++++++++++++++--------------------
 gi/pygboxed.c            |   14 +++++++-------
 gi/pygenum.c             |    6 +++---
 gi/pygflags.c            |    6 +++---
 gi/pygi-error.c          |    8 ++++----
 gi/pygi-source.c         |   16 ++++++++--------
 gi/pyglib.c              |    8 ++++----
 gi/pyglib.h              |    3 ---
 gi/pygobject-object.c    |   36 ++++++++++++++++++------------------
 gi/pygoptiongroup.c      |    9 ++++-----
 gi/pygpointer.c          |    6 +++---
 gi/pygspawn.c            |    4 ++--
 gi/pygtype.c             |   18 +++++++++---------
 tests/testhelpermodule.c |   12 ++++++------
 14 files changed, 91 insertions(+), 95 deletions(-)
---
diff --git a/gi/gobjectmodule.c b/gi/gobjectmodule.c
index 37d3d41..606d1d5 100644
--- a/gi/gobjectmodule.c
+++ b/gi/gobjectmodule.c
@@ -60,11 +60,11 @@ static void
 _pyg_set_thread_block_funcs (PyGThreadBlockFunc block_threads_func,
                             PyGThreadBlockFunc unblock_threads_func)
 {
-    PyGILState_STATE state = pyglib_gil_state_ensure ();
+    PyGILState_STATE state = PyGILState_Ensure ();
     PyErr_Warn (PyExc_DeprecationWarning,
                 "Using pyg_set_thread_block_funcs is not longer needed. "
                 "PyGObject always uses Py_BLOCK/UNBLOCK_THREADS.");
-    pyglib_gil_state_release (state);
+    PyGILState_Release (state);
 }
 
 /**
@@ -80,9 +80,9 @@ pyg_destroy_notify(gpointer user_data)
     PyObject *obj = (PyObject *)user_data;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     Py_DECREF(obj);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 
@@ -166,12 +166,12 @@ pyg_object_set_property (GObject *object, guint property_id,
     PyObject *py_pspec, *py_value;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     object_wrapper = pygobject_new(object);
 
     if (object_wrapper == NULL) {
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return;
     }
 
@@ -190,7 +190,7 @@ pyg_object_set_property (GObject *object, guint property_id,
     Py_DECREF(py_pspec);
     Py_DECREF(py_value);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 static void
@@ -200,12 +200,12 @@ pyg_object_get_property (GObject *object, guint property_id,
     PyObject *object_wrapper, *retval;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     object_wrapper = pygobject_new(object);
 
     if (object_wrapper == NULL) {
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return;
     }
 
@@ -216,7 +216,7 @@ pyg_object_get_property (GObject *object, guint property_id,
     Py_DECREF(object_wrapper);
     Py_XDECREF(retval);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 typedef struct _PyGSignalAccumulatorData {
@@ -236,7 +236,7 @@ _pyg_signal_accumulator(GSignalInvocationHint *ihint,
     PyGSignalAccumulatorData *data = _data;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     if (ihint->detail)
         py_detail = PYGLIB_PyUnicode_FromString(g_quark_to_string(ihint->detail));
     else {
@@ -270,7 +270,7 @@ _pyg_signal_accumulator(GSignalInvocationHint *ihint,
         }
         Py_DECREF(py_retval);
     }
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
     return retval;
 }
 
@@ -1021,7 +1021,7 @@ pygobject__g_instance_init(GTypeInstance   *instance,
            * g_object_new -> we have no python wrapper, so create it
            * now */
         PyGILState_STATE state;
-        state = pyglib_gil_state_ensure();
+        state = PyGILState_Ensure();
         wrapper = pygobject_new_full(object,
                                      /*steal=*/ FALSE,
                                      g_class);
@@ -1037,7 +1037,7 @@ pygobject__g_instance_init(GTypeInstance   *instance,
 
         Py_DECREF(args);
         Py_DECREF(kwargs);
-        pyglib_gil_state_release(state);
+        PyGILState_Release(state);
     }
 }
 
@@ -1395,13 +1395,13 @@ pyg_object_new (PyGObject *self, PyObject *args, PyObject *kwargs)
 static int
 pygobject_gil_state_ensure (void)
 {
-    return pyglib_gil_state_ensure ();
+    return PyGILState_Ensure ();
 }
 
 static void
 pygobject_gil_state_release (int flag)
 {
-    pyglib_gil_state_release(flag);
+    PyGILState_Release(flag);
 }
 
 /* Only for backwards compatibility */
@@ -1433,7 +1433,7 @@ marshal_emission_hook(GSignalInvocationHint *ihint,
     PyObject *params;
     guint i;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     /* construct Python tuple for the parameter values */
     params = PyTuple_New(n_param_values);
@@ -1464,7 +1464,7 @@ marshal_emission_hook(GSignalInvocationHint *ihint,
     retval = (retobj == Py_True ? TRUE : FALSE);
     Py_XDECREF(retobj);
 out:
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
     return retval;
 }
 
@@ -1783,9 +1783,9 @@ _log_func(const gchar *log_domain,
        PyGILState_STATE state;
        PyObject* warning = user_data;
 
-       state = pyglib_gil_state_ensure();
+       state = PyGILState_Ensure();
        PyErr_Warn(warning, (char *) message);
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
     } else
         g_log_default_handler(log_domain, log_level, message, user_data);
 }
diff --git a/gi/pygboxed.c b/gi/pygboxed.c
index 2eaff85..d168a9e 100644
--- a/gi/pygboxed.c
+++ b/gi/pygboxed.c
@@ -39,9 +39,9 @@ static void
 pyg_boxed_dealloc(PyGBoxed *self)
 {
     if (self->free_on_dealloc && pyg_boxed_get_ptr (self)) {
-       PyGILState_STATE state = pyglib_gil_state_ensure();
+       PyGILState_STATE state = PyGILState_Ensure();
        g_boxed_free (self->gtype, pyg_boxed_get_ptr (self));
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
     }
 
     Py_TYPE(self)->tp_free((PyObject *)self);
@@ -203,11 +203,11 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed,
     g_return_val_if_fail(boxed_type != 0, NULL);
     g_return_val_if_fail(!copy_boxed || (copy_boxed && own_ref), NULL);
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     if (!boxed) {
        Py_INCREF(Py_None);
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return Py_None;
     }
 
@@ -221,14 +221,14 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed,
 
     if (!PyType_IsSubtype (tp, &PyGBoxed_Type)) {
         PyErr_Format (PyExc_RuntimeError, "%s isn't a GBoxed", tp->tp_name);
-        pyglib_gil_state_release (state);
+        PyGILState_Release (state);
         return NULL;
     }
 
     self = (PyGBoxed *)tp->tp_alloc(tp, 0);
 
     if (self == NULL) {
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
         return NULL;
     }
 
@@ -238,7 +238,7 @@ pyg_boxed_new(GType boxed_type, gpointer boxed, gboolean copy_boxed,
     self->gtype = boxed_type;
     self->free_on_dealloc = own_ref;
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
     
     return (PyObject *)self;
 }
diff --git a/gi/pygenum.c b/gi/pygenum.c
index 53baaca..522e2ef 100644
--- a/gi/pygenum.c
+++ b/gi/pygenum.c
@@ -244,7 +244,7 @@ pyg_enum_add (PyObject *   module,
         return NULL;
     }
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     /* Create a new type derived from GEnum. This is the same as:
      * >>> stub = type(typename, (GEnum,), {})
@@ -256,7 +256,7 @@ pyg_enum_add (PyObject *   module,
     Py_DECREF(instance_dict);
     if (!stub) {
        PyErr_SetString(PyExc_RuntimeError, "can't create const");
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return NULL;
     }
 
@@ -309,7 +309,7 @@ pyg_enum_add (PyObject *   module,
 
     g_type_class_unref(eclass);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
     return stub;
 }
 
diff --git a/gi/pygflags.c b/gi/pygflags.c
index a38e01c..fa12341 100644
--- a/gi/pygflags.c
+++ b/gi/pygflags.c
@@ -265,7 +265,7 @@ pyg_flags_add (PyObject *   module,
         return NULL;
     }
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     /* Create a new type derived from GFlags. This is the same as:
      * >>> stub = type(typename, (GFlags,), {})
@@ -277,7 +277,7 @@ pyg_flags_add (PyObject *   module,
     Py_DECREF(instance_dict);
     if (!stub) {
        PyErr_SetString(PyExc_RuntimeError, "can't create GFlags subtype");
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
         return NULL;
     }
 
@@ -329,7 +329,7 @@ pyg_flags_add (PyObject *   module,
 
     g_type_class_unref(eclass);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return stub;
 }
diff --git a/gi/pygi-error.c b/gi/pygi-error.c
index 45ca2eb..e3d8838 100644
--- a/gi/pygi-error.c
+++ b/gi/pygi-error.c
@@ -51,7 +51,7 @@ pygi_error_marshal_to_py (GError **error)
     if (*error == NULL)
         return NULL;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     exc_type = PyGError;
     if (exception_table != NULL)
@@ -71,7 +71,7 @@ pygi_error_marshal_to_py (GError **error)
                                           domain,
                                           (*error)->code);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return exc_instance;
 }
@@ -96,14 +96,14 @@ pygi_error_check (GError **error)
     if (*error == NULL)
         return FALSE;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     exc_instance = pygi_error_marshal_to_py (error);
     PyErr_SetObject(PyGError, exc_instance);
     Py_DECREF(exc_instance);
     g_clear_error(error);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return TRUE;
 }
diff --git a/gi/pygi-source.c b/gi/pygi-source.c
index 154b1cd..e84c25e 100644
--- a/gi/pygi-source.c
+++ b/gi/pygi-source.c
@@ -45,7 +45,7 @@ pyg_source_prepare(GSource *source, gint *timeout)
     gboolean got_err = TRUE;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     t = PyObject_CallMethod(pysource->obj, "prepare", NULL);
 
@@ -81,7 +81,7 @@ bail:
 
     Py_XDECREF(t);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return ret;
 }
@@ -94,7 +94,7 @@ pyg_source_check(GSource *source)
     gboolean ret;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     t = PyObject_CallMethod(pysource->obj, "check", NULL);
 
@@ -106,7 +106,7 @@ pyg_source_check(GSource *source)
        Py_DECREF(t);
     }
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return ret;
 }
@@ -119,7 +119,7 @@ pyg_source_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
     gboolean ret;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     if (callback) {
        tuple = user_data;
@@ -141,7 +141,7 @@ pyg_source_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
        Py_DECREF(t);
     }
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return ret;
 }
@@ -153,7 +153,7 @@ pyg_source_finalize(GSource *source)
     PyObject *func, *t;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     func = PyObject_GetAttrString(pysource->obj, "finalize");
     if (func) {
@@ -167,7 +167,7 @@ pyg_source_finalize(GSource *source)
        }
     }
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 static GSourceFuncs pyg_source_funcs =
diff --git a/gi/pyglib.c b/gi/pyglib.c
index b83d605..d21ba4d 100644
--- a/gi/pyglib.c
+++ b/gi/pyglib.c
@@ -79,9 +79,9 @@ _pyglib_destroy_notify(gpointer user_data)
     PyObject *obj = (PyObject *)user_data;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     Py_DECREF(obj);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 gboolean
@@ -93,7 +93,7 @@ _pyglib_handler_marshal(gpointer user_data)
 
     g_return_val_if_fail(user_data != NULL, FALSE);
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     tuple = (PyObject *)user_data;
     ret = PyObject_CallObject(PyTuple_GetItem(tuple, 0),
@@ -106,7 +106,7 @@ _pyglib_handler_marshal(gpointer user_data)
        Py_DECREF(ret);
     }
     
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return res;
 }
diff --git a/gi/pyglib.h b/gi/pyglib.h
index b5e723a..d390f14 100644
--- a/gi/pyglib.h
+++ b/gi/pyglib.h
@@ -31,9 +31,6 @@ G_BEGIN_DECLS
 typedef void (*PyGLibThreadsEnabledFunc) (void);
 typedef void (*PyGLibThreadBlockFunc) (void);
 
-#define pyglib_gil_state_ensure          PyGILState_Ensure
-#define pyglib_gil_state_release         PyGILState_Release
-
 GOptionGroup * pyglib_option_group_transfer_group(PyObject *self);
 
 /* Private: for gobject <-> glib interaction only. */
diff --git a/gi/pygobject-object.c b/gi/pygobject-object.c
index 9eed696..25731b2 100644
--- a/gi/pygobject-object.c
+++ b/gi/pygobject-object.c
@@ -112,7 +112,7 @@ pygobject_data_free(PyGObjectData *data)
 
     if (Py_IsInitialized()) {
        state_saved = TRUE;
-       state = pyglib_gil_state_ensure();
+       state = PyGILState_Ensure();
        Py_DECREF(data->type);
        /* We cannot use Py_BEGIN_ALLOW_THREADS here because this is inside
         * a branch. */
@@ -140,7 +140,7 @@ pygobject_data_free(PyGObjectData *data)
 
     if (state_saved && Py_IsInitialized ()) {
        Py_BLOCK_THREADS; /* Restores _save */
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
     }
 }
 
@@ -606,7 +606,7 @@ pyg_toggle_notify (gpointer data, GObject *object, gboolean is_last_ref)
     PyGObject *self;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     /* Avoid thread safety problems by using qdata for wrapper retrieval
      * instead of the user data argument.
@@ -620,7 +620,7 @@ pyg_toggle_notify (gpointer data, GObject *object, gboolean is_last_ref)
             Py_INCREF(self);
     }
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
   /* Called when the inst_dict is first created; switches the 
@@ -747,7 +747,7 @@ pygobject_new_with_interfaces(GType gtype)
     PyTypeObject *py_parent_type;
     PyObject *bases;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     bases = pyg_type_get_bases(gtype);
     py_parent_type = (PyTypeObject *) PyTuple_GetItem(bases, 0);
@@ -772,7 +772,7 @@ pygobject_new_with_interfaces(GType gtype)
 
     if (type == NULL) {
        PyErr_Print();
-        pyglib_gil_state_release(state);
+        PyGILState_Release(state);
        return NULL;
     }
 
@@ -797,7 +797,7 @@ pygobject_new_with_interfaces(GType gtype)
 
     if (PyType_Ready(type) < 0) {
        g_warning ("couldn't make the type `%s' ready", type->tp_name);
-        pyglib_gil_state_release(state);
+        PyGILState_Release(state);
        return NULL;
     }
 
@@ -805,7 +805,7 @@ pygobject_new_with_interfaces(GType gtype)
     Py_INCREF(type);
     g_type_set_qdata(gtype, pygobject_class_key, type);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     return type;
 }
@@ -1459,10 +1459,10 @@ pygbinding_closure_invalidate(gpointer data, GClosure *closure)
     PyGClosure *pc = (PyGClosure *)closure;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     Py_XDECREF(pc->callback);
     Py_XDECREF(pc->extra_args);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     pc->callback = NULL;
     pc->extra_args = NULL;
@@ -1481,7 +1481,7 @@ pygbinding_marshal (GClosure     *closure,
     PyObject *params, *ret;
     GValue *out_value;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     /* construct Python tuple for the parameter values */
     params = PyTuple_New(2);
@@ -1516,7 +1516,7 @@ pygbinding_marshal (GClosure     *closure,
 
 out:
     Py_DECREF(params);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 static GClosure *
@@ -2219,7 +2219,7 @@ pygobject_weak_ref_notify(PyGObjectWeakRef *self, GObject *dummy)
     self->obj = NULL;
     if (self->callback) {
         PyObject *retval;
-        PyGILState_STATE state = pyglib_gil_state_ensure();
+        PyGILState_STATE state = PyGILState_Ensure();
         retval = PyObject_Call(self->callback, self->user_data, NULL);
         if (retval) {
             if (retval != Py_None)
@@ -2237,7 +2237,7 @@ pygobject_weak_ref_notify(PyGObjectWeakRef *self, GObject *dummy)
             self->have_floating_ref = FALSE;
             Py_DECREF((PyObject *) self);
         }
-        pyglib_gil_state_release(state);
+        PyGILState_Release(state);
     }
 }
 
@@ -2326,9 +2326,9 @@ pyobject_copy(gpointer boxed)
     PyObject *object = boxed;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     Py_INCREF(object);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
     return object;
 }
 
@@ -2338,9 +2338,9 @@ pyobject_free(gpointer boxed)
     PyObject *object = boxed;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     Py_DECREF(object);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 void
diff --git a/gi/pygoptiongroup.c b/gi/pygoptiongroup.c
index bd57489..6ea1964 100644
--- a/gi/pygoptiongroup.c
+++ b/gi/pygoptiongroup.c
@@ -70,7 +70,7 @@ static void
 destroy_g_group(PyGOptionGroup *self)
 {
     PyGILState_STATE state;
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     self->group = NULL;
     Py_CLEAR(self->callback);
@@ -83,7 +83,7 @@ destroy_g_group(PyGOptionGroup *self)
         Py_DECREF(self);
     }
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 static int
@@ -137,8 +137,7 @@ arg_func(const gchar *option_name,
     PyGILState_STATE state;
     gboolean no_error;
 
-    state = pyglib_gil_state_ensure();
-
+    state = PyGILState_Ensure();
     if (value == NULL)
         ret = PyObject_CallFunction(self->callback, "sOO",
                                     option_name, Py_None, self);
@@ -153,7 +152,7 @@ arg_func(const gchar *option_name,
     } else
        no_error = pygi_gerror_exception_check(error) != -1;
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
     return no_error;
 }
 
diff --git a/gi/pygpointer.c b/gi/pygpointer.c
index 64ca983..c7cae19 100644
--- a/gi/pygpointer.c
+++ b/gi/pygpointer.c
@@ -153,11 +153,11 @@ pyg_pointer_new(GType pointer_type, gpointer pointer)
     PyTypeObject *tp;
     g_return_val_if_fail(pointer_type != 0, NULL);
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     if (!pointer) {
        Py_INCREF(Py_None);
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return Py_None;
     }
 
@@ -170,7 +170,7 @@ pyg_pointer_new(GType pointer_type, gpointer pointer)
        tp = (PyTypeObject *)&PyGPointer_Type; /* fallback */
     self = PyObject_NEW(PyGPointer, tp);
 
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     if (self == NULL)
        return NULL;
diff --git a/gi/pygspawn.c b/gi/pygspawn.c
index c66c50f..3806967 100644
--- a/gi/pygspawn.c
+++ b/gi/pygspawn.c
@@ -76,7 +76,7 @@ _pyg_spawn_async_callback(gpointer user_data)
     PyGILState_STATE gil;
 
     data = (struct _PyGChildSetupData *) user_data;
-    gil = pyglib_gil_state_ensure();
+    gil = PyGILState_Ensure();
     if (data->data)
         retval = PyObject_CallFunction(data->func, "O", data->data);
     else
@@ -88,7 +88,7 @@ _pyg_spawn_async_callback(gpointer user_data)
     Py_DECREF(data->func);
     Py_XDECREF(data->data);
     g_slice_free(struct _PyGChildSetupData, data);
-    pyglib_gil_state_release(gil);
+    PyGILState_Release(gil);
 }
 
 PyObject *
diff --git a/gi/pygtype.c b/gi/pygtype.c
index 32132ad..85a6d82 100644
--- a/gi/pygtype.c
+++ b/gi/pygtype.c
@@ -670,11 +670,11 @@ pyg_closure_invalidate(gpointer data, GClosure *closure)
     PyGClosure *pc = (PyGClosure *)closure;
     PyGILState_STATE state;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
     Py_XDECREF(pc->callback);
     Py_XDECREF(pc->extra_args);
     Py_XDECREF(pc->swap_data);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 
     pc->callback = NULL;
     pc->extra_args = NULL;
@@ -694,7 +694,7 @@ pyg_closure_marshal(GClosure *closure,
     PyObject *params, *ret;
     guint i;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     /* construct Python tuple for the parameter values */
     params = PyTuple_New(n_param_values);
@@ -754,7 +754,7 @@ pyg_closure_marshal(GClosure *closure,
 
  out:
     Py_DECREF(params);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 /**
@@ -847,7 +847,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
     PyObject *params, *ret;
     guint i, len;
 
-    state = pyglib_gil_state_ensure();
+    state = PyGILState_Ensure();
 
     g_return_if_fail(invocation_hint != NULL);
     /* get the object passed as the first argument to the closure */
@@ -873,7 +873,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
     if (!method) {
        PyErr_Clear();
        Py_DECREF(object_wrapper);
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return;
     }
     Py_DECREF(object_wrapper);
@@ -887,7 +887,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
        /* error condition */
        if (!item) {
            Py_DECREF(params);
-           pyglib_gil_state_release(state);
+           PyGILState_Release(state);
            return;
        }
        PyTuple_SetItem(params, i - 1, item);
@@ -915,7 +915,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
        PyErr_Print();
        Py_DECREF(method);
        Py_DECREF(params);
-       pyglib_gil_state_release(state);
+       PyGILState_Release(state);
        return;
     }
     Py_DECREF(method);
@@ -923,7 +923,7 @@ pyg_signal_class_closure_marshal(GClosure *closure,
     if (G_IS_VALUE(return_value))
        pyg_value_from_pyobject(return_value, ret);
     Py_DECREF(ret);
-    pyglib_gil_state_release(state);
+    PyGILState_Release(state);
 }
 
 /**
diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c
index fc62b29..343b14f 100644
--- a/tests/testhelpermodule.c
+++ b/tests/testhelpermodule.c
@@ -147,12 +147,12 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self)
     PyObject *py_args;
     PyObject *py_method;
     
-    __py_state = pyg_gil_state_ensure();
+    __py_state = PyGILState_Ensure();
     py_self = pygobject_new((GObject *) self);
     if (!py_self) {
         if (PyErr_Occurred())
             PyErr_Print();
-        pyg_gil_state_release(__py_state);
+        PyGILState_Release(__py_state);
         return;
     }
     py_args = PyTuple_New(0);
@@ -162,7 +162,7 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self)
             PyErr_Print();
         Py_DECREF(py_args);
         Py_DECREF(py_self);
-        pyg_gil_state_release(__py_state);
+        PyGILState_Release(__py_state);
         return;
     }
     py_retval = PyObject_CallObject(py_method, py_args);
@@ -172,7 +172,7 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self)
         Py_DECREF(py_method);
         Py_DECREF(py_args);
         Py_DECREF(py_self);
-        pyg_gil_state_release(__py_state);
+        PyGILState_Release(__py_state);
         return;
     }
     if (py_retval != Py_None) {
@@ -183,7 +183,7 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self)
         Py_DECREF(py_method);
         Py_DECREF(py_args);
         Py_DECREF(py_self);
-        pyg_gil_state_release(__py_state);
+        PyGILState_Release(__py_state);
         return;
     }
     
@@ -191,7 +191,7 @@ _wrap_TestInterface__proxy_do_iface_method(TestInterface *self)
     Py_DECREF(py_method);
     Py_DECREF(py_args);
     Py_DECREF(py_self);
-    pyg_gil_state_release(__py_state);
+    PyGILState_Release(__py_state);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]