Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am	(revision 949)
+++ tests/Makefile.am	(working copy)
@@ -1,6 +1,7 @@
 INCLUDES = \
 	$(PYTHON_INCLUDES) \
 	$(GLIB_CFLAGS) \
+	-I$(top_srcdir)/glib \
 	-I$(top_srcdir)/gobject
 
 EXTRA_DIST = \
Index: gobject/pygobject.h
===================================================================
--- gobject/pygobject.h	(revision 949)
+++ gobject/pygobject.h	(working copy)
@@ -6,6 +6,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
+#include <pyglib.h>
 
 G_BEGIN_DECLS
 
@@ -266,26 +267,17 @@
 #define pyg_gerror_exception_check (_PyGObject_API->gerror_exception_check)
 #define pyg_option_group_new       (_PyGObject_API->option_group_new)
 
-#define pyg_block_threads()   G_STMT_START {   \
-    if (_PyGObject_API->block_threads != NULL) \
-      (* _PyGObject_API->block_threads)();     \
+#define pyg_block_threads()   G_STMT_START {	\
+	pyglib_block_threads();			\
   } G_STMT_END
-#define pyg_unblock_threads() G_STMT_START {     \
-    if (_PyGObject_API->unblock_threads != NULL) \
-      (* _PyGObject_API->unblock_threads)();     \
+#define pyg_unblock_threads() G_STMT_START {	\
+	pyglib_unblock_threads();		\
   } G_STMT_END
 
-#define pyg_threads_enabled (_PyGObject_API->threads_enabled)
+#define pyg_threads_enabled (pyglib_threads_enabled())
 
-#define pyg_begin_allow_threads                 \
-    G_STMT_START {                              \
-        PyThreadState *_save = NULL;            \
-        if (_PyGObject_API->threads_enabled)    \
-            _save = PyEval_SaveThread();
-#define pyg_end_allow_threads                   \
-        if (_PyGObject_API->threads_enabled)    \
-            PyEval_RestoreThread(_save);        \
-    } G_STMT_END
+#define pyg_begin_allow_threads pyglib_begin_allow_threads
+#define pyg_end_allow_threads   pyglib_end_allow_threads
 
 
 /**
