pygobject r922 - in trunk: . glib gobject



Author: paulp
Date: Sun Aug  3 15:35:17 2008
New Revision: 922
URL: http://svn.gnome.org/viewvc/pygobject?rev=922&view=rev

Log:
2008-08-03  Paul Pogonyshev  <pogonyshev gmx net>

	* 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).


Modified:
   trunk/ChangeLog
   trunk/glib/pyglib.c
   trunk/glib/pyglib.h
   trunk/gobject/gobjectmodule.c

Modified: trunk/glib/pyglib.c
==============================================================================
--- trunk/glib/pyglib.c	(original)
+++ trunk/glib/pyglib.c	Sun Aug  3 15:35:17 2008
@@ -119,24 +119,24 @@
 }
 
 #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_API->threads_enabled = TRUE;
     pyglib_thread_state_tls_key = PyThread_create_key();
     
-    return TRUE;
+    return 0;
 }
 #endif
 

Modified: trunk/glib/pyglib.h
==============================================================================
--- trunk/glib/pyglib.h	(original)
+++ trunk/glib/pyglib.h	Sun Aug  3 15:35:17 2008
@@ -34,7 +34,7 @@
 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,

Modified: trunk/gobject/gobjectmodule.c
==============================================================================
--- trunk/gobject/gobjectmodule.c	(original)
+++ trunk/gobject/gobjectmodule.c	Sun Aug  3 15:35:17 2008
@@ -1788,7 +1788,7 @@
 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);



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