summaryrefslogtreecommitdiffstats
path: root/gobject/pygenum.c
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2004-08-02 11:03:05 +0000
committerJohan Dahlin <johan@src.gnome.org>2004-08-02 11:03:05 +0000
commit3e41db376f6e40c2df01a1f83c2ecf10a5315084 (patch)
treea4146d2ca0d7516cbcd334048286a710e2692a58 /gobject/pygenum.c
parentfa82703297dadadf71b26650a8bafd55fc101dce (diff)
downloadpygobject-3e41db376f6e40c2df01a1f83c2ecf10a5315084.tar.gz
pygobject-3e41db376f6e40c2df01a1f83c2ecf10a5315084.tar.xz
pygobject-3e41db376f6e40c2df01a1f83c2ecf10a5315084.zip
Call PyEval_InitThreads. Perhaps its something that always should bePYGTK_2_3_95
* gobject/gobjectmodule.c (initgobject): Call PyEval_InitThreads. Perhaps its something that always should be called. * README (Author): Add a requirements section * configure.in: Require Python 2.3 * setup.py (version): Ditto * gobject/pygtype.c, gobject/pygobject.h: Remove 2.2 compat. * All over the place: Add support for PyGILState.
Diffstat (limited to 'gobject/pygenum.c')
-rw-r--r--gobject/pygenum.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gobject/pygenum.c b/gobject/pygenum.c
index 0f440ad..6925778 100644
--- a/gobject/pygenum.c
+++ b/gobject/pygenum.c
@@ -149,6 +149,7 @@ pyg_enum_add (PyObject * module,
const char * strip_prefix,
GType gtype)
{
+ PyGILState_STATE state;
PyObject *instance_dict, *stub, *values;
GEnumClass *eclass;
int i;
@@ -157,6 +158,8 @@ pyg_enum_add (PyObject * module,
g_return_val_if_fail(typename != NULL, NULL);
g_return_val_if_fail(g_type_is_a(gtype, G_TYPE_ENUM), NULL);
+ state = PyGILState_Ensure();
+
instance_dict = PyDict_New();
stub = PyObject_CallFunction((PyObject *)&PyType_Type, "s(O)O",
typename, (PyObject *)&PyGEnum_Type,
@@ -164,6 +167,7 @@ pyg_enum_add (PyObject * module,
Py_DECREF(instance_dict);
if (!stub) {
PyErr_SetString(PyExc_RuntimeError, "can't create const");
+ PyGILState_Release(state);
return NULL;
}
@@ -205,8 +209,9 @@ pyg_enum_add (PyObject * module,
Py_DECREF(values);
g_type_class_unref(eclass);
-
- return stub;
+
+ PyGILState_Release(state);
+ return stub;
}
static PyObject *