summaryrefslogtreecommitdiffstats
path: root/gobject/pygflags.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/pygflags.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/pygflags.c')
-rw-r--r--gobject/pygflags.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gobject/pygflags.c b/gobject/pygflags.c
index d897d8a..4a8211d 100644
--- a/gobject/pygflags.c
+++ b/gobject/pygflags.c
@@ -182,6 +182,7 @@ pyg_flags_add (PyObject * module,
const char * strip_prefix,
GType gtype)
{
+ PyGILState_STATE state;
PyObject *instance_dict, *stub, *values;
GFlagsClass *eclass;
int i;
@@ -190,6 +191,8 @@ pyg_flags_add (PyObject * module,
g_return_val_if_fail(typename != NULL, NULL);
g_return_val_if_fail(g_type_is_a(gtype, G_TYPE_FLAGS), NULL);
+ state = PyGILState_Ensure();
+
instance_dict = PyDict_New();
stub = PyObject_CallFunction((PyObject *)&PyType_Type, "s(O)O",
typename, (PyObject *)&PyGFlags_Type,
@@ -197,7 +200,7 @@ pyg_flags_add (PyObject * module,
Py_DECREF(instance_dict);
if (!stub) {
PyErr_SetString(PyExc_RuntimeError, "can't create const");
- return NULL;
+ PyGILState_Release(state);
}
PyDict_SetItemString(((PyTypeObject *)stub)->tp_dict,
@@ -231,7 +234,7 @@ pyg_flags_add (PyObject * module,
strip_prefix),
item);
Py_INCREF(item);
- }
+ }
PyDict_SetItemString(((PyTypeObject *)stub)->tp_dict,
"__flags_values__", values);
@@ -239,6 +242,8 @@ pyg_flags_add (PyObject * module,
g_type_class_unref(eclass);
+ PyGILState_Release(state);
+
return stub;
}