From cc630ab67b9483f9c3c71ffa2ecffee7d61bed8c Mon Sep 17 00:00:00 2001 From: Paul Pogonyshev Date: Sun, 3 Aug 2008 15:35:17 +0000 Subject: Change return value from 'gboolean' to 'int' and changed semantics to 2008-08-03 Paul Pogonyshev * glib/pyglib.h: * glib/pyglib.c (pyglib_enable_threads): Change return value from 'gboolean' to 'int' and changed semantics to Pythonic: restores backwards compatibility. * gobject/gobjectmodule.c (pyg_threads_init): Treat return value accordingly (bug #544946). svn path=/trunk/; revision=922 --- ChangeLog | 10 ++++++++++ glib/pyglib.c | 12 ++++++------ glib/pyglib.h | 2 +- gobject/gobjectmodule.c | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index e66914f..8522a24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-08-03 Paul Pogonyshev + + * glib/pyglib.h: + * glib/pyglib.c (pyglib_enable_threads): Change return value from + 'gboolean' to 'int' and changed semantics to Pythonic: restores + backwards compatibility. + + * gobject/gobjectmodule.c (pyg_threads_init): Treat return value + accordingly (bug #544946). + 2008-08-02 Gian Mario Tagliaretti Bug 546020 – Wrap GFile.create_async diff --git a/glib/pyglib.c b/glib/pyglib.c index 1c33995..3dd05a4 100644 --- a/glib/pyglib.c +++ b/glib/pyglib.c @@ -119,24 +119,24 @@ pyglib_gil_state_release(PyGILState_STATE state) } #ifdef DISABLE_THREADING -gboolean +int pyglib_enable_threads(void) { PyErr_SetString(PyExc_RuntimeError, "pyglib threading disabled at compile time"); - return FALSE; + return -1; } #else /* Enable threading; note that the GIL must be held by the current * thread when this function is called */ -gboolean +int pyglib_enable_threads(void) { - g_return_val_if_fail (_PyGLib_API != NULL, FALSE); + g_return_val_if_fail (_PyGLib_API != NULL, -1); if (_PyGLib_API->threads_enabled) - return TRUE; + return 0; PyEval_InitThreads(); if (!g_threads_got_initialized) @@ -145,7 +145,7 @@ pyglib_enable_threads(void) _PyGLib_API->threads_enabled = TRUE; pyglib_thread_state_tls_key = PyThread_create_key(); - return TRUE; + return 0; } #endif diff --git a/glib/pyglib.h b/glib/pyglib.h index d7322d3..66ac139 100644 --- a/glib/pyglib.h +++ b/glib/pyglib.h @@ -34,7 +34,7 @@ void pyglib_init(void); void pyglib_init_internal(PyObject *api); PyGILState_STATE pyglib_gil_state_ensure(void); void pyglib_gil_state_release(PyGILState_STATE state); -gboolean pyglib_enable_threads(void); +int pyglib_enable_threads(void); gboolean pyglib_error_check(GError **error); gboolean pyglib_gerror_exception_check(GError **error); PyObject *pyglib_register_exception_for_domain(gchar *name, diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index a95aede..4d47d71 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -1788,7 +1788,7 @@ pygobject_gil_state_release (int flag) static PyObject * pyg_threads_init (PyObject *unused, PyObject *args, PyObject *kwargs) { - if (!pyglib_enable_threads()) + if (pyglib_enable_threads()) return NULL; Py_INCREF(Py_None); -- cgit