[pygobject/pygobject-3-10] Add threads_init back as a requirement for non-Python threaded repos
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/pygobject-3-10] Add threads_init back as a requirement for non-Python threaded repos
- Date: Sat, 19 Oct 2013 00:30:50 +0000 (UTC)
commit 7036e9d79ed49fe153758ec0507d6af62f067f2f
Author: Simon Feltman <sfeltman src gnome org>
Date: Fri Oct 18 17:15:06 2013 -0700
Add threads_init back as a requirement for non-Python threaded repos
Re-add a "threads_init" function to gi for explicit intialization of Python
threading support. This was marked as deprecated in the previous cycle
because using Python threads already initializes everything.
However, we still need an explicit initalization when using repositories
with non-Python threads which may interact with Python callbacks
(GStreamer).
https://bugzilla.gnome.org/show_bug.cgi?id=710447
gi/gimodule.c | 10 ++++++++++
gi/overrides/GLib.py | 9 +--------
2 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/gi/gimodule.c b/gi/gimodule.c
index 12dfb36..478a530 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -599,6 +599,12 @@ pyg_channel_read(PyObject* self, PyObject *args, PyObject *kwargs)
return NULL;
}
+static PyObject *
+_pygi_threads_init (PyObject *self, PyObject *dummy)
+{
+ PyEval_InitThreads ();
+ Py_RETURN_NONE;
+}
static PyMethodDef _gi_functions[] = {
{ "enum_add", (PyCFunction) _wrap_pyg_enum_add, METH_VARARGS | METH_KEYWORDS },
@@ -613,6 +619,10 @@ static PyMethodDef _gi_functions[] = {
{ "source_new", (PyCFunction) _wrap_pyg_source_new, METH_NOARGS },
{ "source_set_callback", (PyCFunction) pyg_source_set_callback, METH_VARARGS },
{ "io_channel_read", (PyCFunction) pyg_channel_read, METH_VARARGS },
+ { "threads_init", (PyCFunction) _pygi_threads_init, METH_NOARGS,
+ "Initialize Python threading support. This only needs to be called "
+ "when using GI repositories with non-Python threads which may interact "
+ "with Python callbacks (GStreamer)."},
{ NULL, NULL, 0 }
};
diff --git a/gi/overrides/GLib.py b/gi/overrides/GLib.py
index f4b1ef5..3eaba1f 100644
--- a/gi/overrides/GLib.py
+++ b/gi/overrides/GLib.py
@@ -25,7 +25,7 @@ import sys
from ..module import get_introspection_module
from .._gi import (variant_new_tuple, variant_type_from_string, source_new,
- source_set_callback, io_channel_read)
+ source_set_callback, io_channel_read, threads_init)
from ..overrides import override, deprecated
from gi import PyGIDeprecationWarning, version_info
@@ -46,13 +46,6 @@ OptionGroup = _glib.OptionGroup
Pid = _glib.Pid
spawn_async = _glib.spawn_async
-
-def threads_init():
- warnings.warn('threads_init no longer needs to be called. '
- 'See: https://bugzilla.gnome.org/show_bug.cgi?id=686914',
- PyGIDeprecationWarning)
-
-
__all__ += ['GError', 'OptionContext', 'OptionGroup', 'Pid',
'spawn_async', 'threads_init']
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]