+commit af8d048442b924c72a1d0ae868ee63ccf292759d
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Fri May 24 13:03:07 2013 +0200
+
+ examples/option.py: Port to GI and Python 3
+
+ examples/option.py | 38 +++++++++++++++++++-------------------
+ 1 file changed, 19 insertions(+), 19 deletions(-)
+
+commit bef5939ca77f4d6939cd9229bd124dfe825b3bdb
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Sun May 12 18:58:06 2013 -0700
+
+ Fix vfunc info search for classes with multiple inheritance
+
+ Ensure the search for vfunc GI info continues recursively even if the
+ current class being looked at does not contain GI info of type
+ InterfaceInfo. This more exhaustive search is needed for setups with
+ multiple sub-classes and multiple inheritance.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=700092
+
+ gi/types.py | 12 +++++++-----
+ tests/test_gi.py | 1 -
+ 2 files changed, 7 insertions(+), 6 deletions(-)
+
+commit 5b8dff59baa1a3e524dac7877dd5b33dea52b026
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Sun May 12 22:19:38 2013 -0700
+
+ Fix closure argument conversion for enum and flag in args
+
+ Replace incorrect cast and assignment of double with uint for flags
+ and enums.
+
+ gi/pygi-closure.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 065503d5e284dc89bacd79d0d9a72eb739882bf8
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Sat May 11 21:47:54 2013 -0700
+
+ tests: Add tests for overriding vfunc implementations
+
+ Add tests for overriding vfuncs for both single inheritance
+ and multiple inheritance with an interface (currently failing).
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=700092
+
+ tests/test_gi.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+commit c4e1112840004af264b4f2a052f333ea38f95cb6
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Sat May 11 20:28:22 2013 -0700
+
+ Fix marshaling Python to FFI return value for enum and flags
+
+ Add break to GI_TYPE_TAG_INTERFACE case. This was falling through
+ causing
+ assignment of arg.v_pointer to the ffi return arg.
+
+ gi/pygi-closure.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit a703217eaf4075e9720d4247351e1dfc4f553772
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Fri Apr 19 06:37:24 2013 -0700
+
+ Remove half implemented GC in PyGIBaseInfo, PyGIStruct, and PyGIBoxed
+
+ Remove half implemented GC tracking from PyGIBaseInfo as it was not
+ needed (the implemented was also missing usage of
+ PyObject_GC_New/Track).
+ Ensure weakref list for PyGIBaseInfo is initialized to NULL and
+ cleared
+ properly.
+ Remove invalid calls to PyObject_GC_UnTrack and PyObject_ClearWeakRefs
+ for both PyGIStruct and PyGIBoxed as these types were not being
+ advertised as GC aware with Py_TPFLAGS_HAVE_GC.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=677091
+
+ gi/pygi-boxed.c | 4 ----
+ gi/pygi-info.c | 20 +++++---------------
+ gi/pygi-struct.c | 4 ----
+ 3 files changed, 5 insertions(+), 23 deletions(-)
+
+commit 87e41db2e060acd689a2ac043bc1ac51007de6f3
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Fri May 3 02:00:07 2013 -0700
+
+ Replace usage of pyg_begin_allow_threads with Py_BEGIN_ALLOW_THREADS
+
+ Replace all usage of pyg[lib]_begin_allow_threads with direct usage
+ of Py_BEGIN_ALLOW_THREADS.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=699440
+
+ gi/_glib/pyglib.h | 4 ----
+ gi/_glib/pygoptioncontext.c | 4 ++--
+ gi/_gobject/pygobject.c | 33 ++++++++++++++++-----------------
+ gi/gimodule.c | 4 ++--
+ gi/pygi-invoke.c | 4 ++--
+ 5 files changed, 22 insertions(+), 27 deletions(-)
+
+commit c9e95663d05de98a9abd3d1479554b1f09753382
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Thu May 2 03:57:05 2013 -0700
+
+ Remove and deprecate API for setting of thread blocking functions
+
+ Remove pyglib_set_thread_block_funcs and deprecate
+ pyg_set_thread_block_funcs.
+ The thread block function APIs are no longer be neccessary because
+ PyGObject
+ can use the Python C API directly when working with threads.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=699440
+
+ gi/_glib/pyglib.c | 41 -----------------------------------
+ gi/_glib/pyglib.h | 9 ++++----
+ gi/_gobject/gobjectmodule.c | 25 ++++++++-------------
+ gi/_gobject/pygobject-private.h | 33 ----------------------------
+ gi/_gobject/pygobject.h | 48
+ ++++++++++++++++++++---------------------
+ gi/gimodule.c | 15 +++++++------
+ 6 files changed, 46 insertions(+), 125 deletions(-)
+
+commit 05498a5732582a5ed1944bd1383af154ca5fc4e6
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Tue Apr 30 11:51:05 2013 -0700
+
+ configure.ac: Post-release bump to 3.9.2
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
commit 902bb6685fd9c90c7d81127861a152b0fab4b107
Author: Martin Pitt <martinpitt@gnome.org>
Date: Tue Apr 30 11:49:03 2013 -0700
+3.9.2 28-May-2013
+ - examples/option.py: Port to GI and Python 3 (Martin Pitt)
+ - Fix vfunc info search for classes with multiple inheritance
+ (Simon Feltman) (#700092)
+ - Fix closure argument conversion for enum and flag in args
+ (Simon Feltman)
+ - Fix marshaling Python to FFI return value for enum and flags
+ (Simon Feltman)
+ - Remove half implemented GC in PyGIBaseInfo, PyGIStruct, and PyGIBoxed
+ (Simon Feltman) (#677091)
+ - Replace usage of pyg_begin_allow_threads with Py_BEGIN_ALLOW_THREADS
+ (Simon Feltman) (#699440)
+ - Remove and deprecate API for setting of thread blocking functions
+ (Simon Feltman) (#699440)
+
3.9.1 30-Apr-2013
- gtk-demo: Wrap description strings at 80 characters (Simon Feltman)
(#698547)
Metadata-Version: 1.0
Name: PyGObject
-Version: 3.9.1
+Version: 3.9.2
Summary: Python bindings for GObject
Home-page: http://www.pygtk.org/
Author: James Henstridge
Maintainer: Johan Dahlin
Maintainer-email: johan@gnome.org
License: GNU LGPL
-Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.1.tar.gz
+Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.2.tar.gz
Description: Python bindings for GLib and GObject
Platform: POSIX, Windows
Classifier: Development Status :: 5 - Production/Stable
# Use recursive makes in order to ignore errors during check
check-code-coverage:
-ifdef CODE_COVERAGE_ENABLED
+ifeq ($(CODE_COVERAGE_ENABLED),yes)
-$(MAKE) $(AM_MAKEFLAGS) -k check
$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
else
# Capture code coverage data
code-coverage-capture: code-coverage-capture-hook
-ifdef CODE_COVERAGE_ENABLED
+ifeq ($(CODE_COVERAGE_ENABLED),yes)
$(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_OPTIONS)
$(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)"
-@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
# Hook rule executed before code-coverage-capture, overridable by the user
code-coverage-capture-hook:
+ifeq ($(CODE_COVERAGE_ENABLED),yes)
clean: code-coverage-clean
code-coverage-clean:
-$(LCOV) --directory $(top_builddir) -z
-rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
-find . -name "*.gcda" -o -name "*.gcov" -delete
+endif
GITIGNOREFILES ?=
GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pygobject 3.9.1.
+# Generated by GNU Autoconf 2.69 for pygobject 3.9.2.
#
# Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>.
#
# Identity of this package.
PACKAGE_NAME='pygobject'
PACKAGE_TARNAME='pygobject'
-PACKAGE_VERSION='3.9.1'
-PACKAGE_STRING='pygobject 3.9.1'
+PACKAGE_VERSION='3.9.2'
+PACKAGE_STRING='pygobject 3.9.2'
PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject'
PACKAGE_URL='https://live.gnome.org/PyGObject/'
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures pygobject 3.9.1 to adapt to many kinds of systems.
+\`configure' configures pygobject 3.9.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of pygobject 3.9.1:";;
+ short | recursive ) echo "Configuration of pygobject 3.9.2:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-pygobject configure 3.9.1
+pygobject configure 3.9.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by pygobject $as_me 3.9.1, which was
+It was created by pygobject $as_me 3.9.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
PYGOBJECT_MINOR_VERSION=9
-$as_echo "#define PYGOBJECT_MICRO_VERSION 1" >>confdefs.h
+$as_echo "#define PYGOBJECT_MICRO_VERSION 2" >>confdefs.h
-PYGOBJECT_MICRO_VERSION=1
+PYGOBJECT_MICRO_VERSION=2
ac_config_headers="$ac_config_headers config.h"
# Define the identity of the package.
PACKAGE='pygobject'
- VERSION='3.9.1'
+ VERSION='3.9.2'
cat >>confdefs.h <<_ACEOF
# Use recursive makes in order to ignore errors during check
check-code-coverage:
-ifdef CODE_COVERAGE_ENABLED
+ifeq ($(CODE_COVERAGE_ENABLED),yes)
-$(MAKE) $(AM_MAKEFLAGS) -k check
$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
else
# Capture code coverage data
code-coverage-capture: code-coverage-capture-hook
-ifdef CODE_COVERAGE_ENABLED
+ifeq ($(CODE_COVERAGE_ENABLED),yes)
$(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_OPTIONS)
$(LCOV) $(code_coverage_quiet) --directory $(CODE_COVERAGE_DIRECTORY) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)"
-@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
# Hook rule executed before code-coverage-capture, overridable by the user
code-coverage-capture-hook:
+ifeq ($(CODE_COVERAGE_ENABLED),yes)
clean: code-coverage-clean
code-coverage-clean:
-$(LCOV) --directory $(top_builddir) -z
-rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
-find . -name "*.gcda" -o -name "*.gcov" -delete
+endif
GITIGNOREFILES ?=
GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by pygobject $as_me 3.9.1, which was
+This file was extended by pygobject $as_me 3.9.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-pygobject config.status 3.9.1
+pygobject config.status 3.9.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
dnl the pygobject version number
m4_define(pygobject_major_version, 3)
m4_define(pygobject_minor_version, 9)
-m4_define(pygobject_micro_version, 1)
+m4_define(pygobject_micro_version, 2)
m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version)
dnl versions of packages we require ...
#!/usr/bin/env python
-# gnome-python/pygobject/examples/option.py
-from gobject.option import OptionGroup, OptionParser, make_option
+from gi.repository import GLib
-group = OptionGroup("example", "OptionGroup Example", "Shows all example options",
- option_list=[make_option("--example",
- action="store_true",
- dest="example",
- help="An example option."),
- ])
+group = GLib.option.OptionGroup(
+ "example", "OptionGroup Example", "Shows all example options",
+ option_list=[GLib.option.make_option("--example",
+ action="store_true",
+ dest="example",
+ help="An example option."),
+ ])
-parser = OptionParser("NAMES ...",
- description="A simple gobject.option example.",
- option_list=[make_option("--file", "-f",
- type="filename",
- action="store",
- dest="file",
- help="A filename option"),
- # ...
- ])
+parser = GLib.option.OptionParser(
+ "NAMES ...", description="A simple gobject.option example.",
+ option_list=[GLib.option.make_option("--file", "-f",
+ type="filename",
+ action="store",
+ dest="file",
+ help="A filename option"),
+ # ...
+ ])
parser.add_option_group(group)
parser.parse_args()
-print "group: example ", group.values.example
-print "parser: file", parser.values.file
+print("group: example " + str(group.values.example))
+print("parser: file " + str(parser.values.file))
}
/**
- * pyglib_block_threads:
- *
- */
-void
-pyglib_block_threads(void)
-{
- g_return_if_fail (_PyGLib_API != NULL);
-
- if (_PyGLib_API->block_threads != NULL)
- (* _PyGLib_API->block_threads)();
-}
-
-/**
- * pyglib_unblock_threads:
- *
- */
-void
-pyglib_unblock_threads(void)
-{
- g_return_if_fail (_PyGLib_API != NULL);
- if (_PyGLib_API->unblock_threads != NULL)
- (* _PyGLib_API->unblock_threads)();
-}
-
-/**
- * pyglib_set_thread_block_funcs:
- *
- * hooks to register handlers for getting GDK threads to cooperate
- * with python threading
- */
-void
-pyglib_set_thread_block_funcs (PyGLibThreadBlockFunc block_threads_func,
- PyGLibThreadBlockFunc unblock_threads_func)
-{
- g_return_if_fail (_PyGLib_API != NULL);
-
- _PyGLib_API->block_threads = block_threads_func;
- _PyGLib_API->unblock_threads = unblock_threads_func;
-}
-
-/**
* pyglib_error_marshal:
* @error: a pointer to the GError.
*
#ifdef DISABLE_THREADING
# define pyglib_gil_state_ensure() PyGILState_LOCKED
# define pyglib_gil_state_release(state) state
-# define pyglib_begin_allow_threads G_STMT_START {
-# define pyglib_end_allow_threads } G_STMT_END
#else
# define pyglib_gil_state_ensure PyGILState_Ensure
# define pyglib_gil_state_release PyGILState_Release
-# define pyglib_begin_allow_threads Py_BEGIN_ALLOW_THREADS
-# define pyglib_end_allow_threads Py_END_ALLOW_THREADS
#endif
+/* Deprecated, only available for API compatibility. */
+#define pyg_set_thread_block_funcs(a, b)
+#define pyglib_block_threads()
+#define pyglib_unblock_threads()
+
gboolean pyglib_error_check(GError **error);
PyObject *pyglib_error_marshal (GError **error);
gboolean pyglib_gerror_exception_check(GError **error);
PyObject *pyglib_register_exception_for_domain(gchar *name,
gint error_domain);
-void pyglib_set_thread_block_funcs(PyGLibThreadBlockFunc block_threads_func,
- PyGLibThreadBlockFunc unblock_threads_func);
-void pyglib_block_threads(void);
-void pyglib_unblock_threads(void);
PyObject * pyglib_option_context_new(GOptionContext *context);
PyObject * pyglib_option_group_new(GOptionGroup *group);
GOptionGroup * pyglib_option_group_transfer_group(PyObject *self);
g_assert(argv_length <= G_MAXINT);
argv_length_int = argv_length;
- pyglib_begin_allow_threads;
+ Py_BEGIN_ALLOW_THREADS;
result = g_option_context_parse(self->context, &argv_length_int, &argv_content,
&error);
- pyglib_end_allow_threads;
+ Py_END_ALLOW_THREADS;
argv_length = argv_length_int;
if (!result)
/**
* pyg_set_thread_block_funcs:
- * @block_threads_func: a function to block Python threads.
- * @unblock_threads_func: a function to unblock Python threads.
- *
- * an interface to allow pygtk to add hooks to handle threading
- * similar to the old PyGTK 0.6.x releases. May not work quite right
- * anymore.
+ * Deprecated, only available for ABI compatibility.
*/
static void
-pyg_set_thread_block_funcs (PyGThreadBlockFunc block_threads_func,
- PyGThreadBlockFunc unblock_threads_func)
+_pyg_set_thread_block_funcs (PyGThreadBlockFunc block_threads_func,
+ PyGThreadBlockFunc unblock_threads_func)
{
- g_return_if_fail(pygobject_api_functions.block_threads == NULL &&
- pygobject_api_functions.unblock_threads == NULL);
-
- pygobject_api_functions.block_threads = block_threads_func;
- pygobject_api_functions.unblock_threads = unblock_threads_func;
- pyglib_set_thread_block_funcs(block_threads_func,
- unblock_threads_func);
+ PyGILState_STATE state = pyglib_gil_state_ensure ();
+ PyErr_Warn (PyExc_DeprecationWarning,
+ "Using pyg_set_thread_block_funcs is not longer needed. "
+ "PyGObject always uses Py_BLOCK/UNBLOCK_THREADS.");
+ pyglib_gil_state_release (state);
}
/**
pyg_error_check,
- pyg_set_thread_block_funcs,
+ _pyg_set_thread_block_funcs,
(PyGThreadBlockFunc)0, /* block_threads */
(PyGThreadBlockFunc)0, /* unblock_threads */
/* from gobjectmodule.c */
extern struct _PyGObject_Functions pygobject_api_functions;
-#define pyg_block_threads() G_STMT_START { \
- if (pygobject_api_functions.block_threads != NULL) \
- (* pygobject_api_functions.block_threads)(); \
- } G_STMT_END
-#define pyg_unblock_threads() G_STMT_START { \
- if (pygobject_api_functions.unblock_threads != NULL) \
- (* pygobject_api_functions.unblock_threads)(); \
- } G_STMT_END
-
-#define pyg_threads_enabled (pygobject_api_functions.threads_enabled)
-
-#ifdef DISABLE_THREADING
-#define pyg_gil_state_ensure() 0
-#define pyg_gil_state_release(state) G_STMT_START { \
- } G_STMT_END
-
-#else
-#define pyg_gil_state_ensure() (pygobject_api_functions.threads_enabled? (PyGILState_Ensure()) : 0)
-#define pyg_gil_state_release(state) G_STMT_START { \
- if (pygobject_api_functions.threads_enabled) \
- PyGILState_Release(state); \
- } G_STMT_END
-#endif
-
-#define pyg_begin_allow_threads \
- G_STMT_START { \
- PyThreadState *_save = NULL; \
- if (pygobject_api_functions.threads_enabled) \
- _save = PyEval_SaveThread();
-#define pyg_end_allow_threads \
- if (pygobject_api_functions.threads_enabled) \
- PyEval_RestoreThread(_save); \
- } G_STMT_END
#ifndef Py_CLEAR /* since Python 2.4 */
if (Py_IsInitialized()) {
state = pyglib_gil_state_ensure();
Py_DECREF(data->type);
- /* We cannot use pyg_begin_allow_threads here because this is inside
+ /* We cannot use Py_BEGIN_ALLOW_THREADS here because this is inside
* a branch. */
- if (pyg_threads_enabled)
- _save = PyEval_SaveThread();
+ Py_UNBLOCK_THREADS; /* Modifies _save */
}
tmp = closures = data->closures;
g_free(data);
if (Py_IsInitialized()) {
- if (pyg_threads_enabled)
- PyEval_RestoreThread(_save);
+ Py_BLOCK_THREADS; /* Restores _save */
pyglib_gil_state_release(state);
}
}
/* The GType is implemented in Python, or we failed to read it via gi:
* do a straightforward read. */
+ Py_BEGIN_ALLOW_THREADS;
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec));
- pyg_begin_allow_threads;
g_object_get_property(self->pygobject->obj, pspec->name, &value);
- pyg_end_allow_threads;
+ Py_END_ALLOW_THREADS;
+
ret = pyg_param_gvalue_as_pyobject(&value, TRUE, pspec);
g_value_unset(&value);
return FALSE;
}
- pyg_begin_allow_threads;
+ Py_BEGIN_ALLOW_THREADS;
g_object_set_property(obj, pspec->name, &value);
- pyg_end_allow_threads;
-
g_value_unset(&value);
-
+ Py_END_ALLOW_THREADS;
+
return TRUE;
}
g_object_remove_toggle_ref(self->obj, pyg_toggle_notify, self);
self->private_flags.flags &= ~PYGOBJECT_USING_TOGGLE_REF;
} else {
- pyg_begin_allow_threads;
+ Py_BEGIN_ALLOW_THREADS;
g_object_unref(self->obj);
- pyg_end_allow_threads;
+ Py_END_ALLOW_THREADS;
}
self->obj = NULL;
}
return NULL;
}
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec));
- pyg_begin_allow_threads;
+ Py_BEGIN_ALLOW_THREADS;
g_object_get_property(self->obj, param_name, &value);
- pyg_end_allow_threads;
+ Py_END_ALLOW_THREADS;
+
ret = pyg_param_gvalue_as_pyobject(&value, TRUE, pspec);
g_value_unset(&value);
return ret;
}
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec));
- pyg_begin_allow_threads;
+ Py_BEGIN_ALLOW_THREADS;
g_object_get_property(self->obj, property_name, &value);
- pyg_end_allow_threads;
+ Py_END_ALLOW_THREADS;
item = pyg_value_as_pyobject(&value, TRUE);
PyTuple_SetItem(tuple, i, item);
PyGThreadBlockFunc unblock_threads_func);
PyGThreadBlockFunc block_threads;
PyGThreadBlockFunc unblock_threads;
+
PyTypeObject *paramspec_type;
PyObject *(* paramspec_new)(GParamSpec *spec);
GParamSpec *(*paramspec_get)(PyObject *tuple);
PyTypeObject *object_type;
};
+
+#ifdef DISABLE_THREADING
+# define pyg_threads_enabled FALSE
+# define pyg_gil_state_ensure() 0
+# define pyg_gil_state_release(state)
+# define pyg_begin_allow_threads G_STMT_START {
+# define pyg_end_allow_threads } G_STMT_END
+#else
+# define pyg_threads_enabled TRUE
+# define pyg_gil_state_ensure PyGILState_Ensure
+# define pyg_gil_state_release PyGILState_Release
+# define pyg_begin_allow_threads Py_BEGIN_ALLOW_THREADS
+# define pyg_end_allow_threads Py_END_ALLOW_THREADS
+#endif
+
+/* Deprecated, only available for API compatibility. */
+#define pyg_enable_threads()
+#define pyg_set_thread_block_funcs(a, b)
+#define pyg_block_threads()
+#define pyg_unblock_threads()
+
+
#ifndef _INSIDE_PYGOBJECT_
#if defined(NO_IMPORT) || defined(NO_IMPORT_PYGOBJECT)
#define pyg_flags_add_constants (_PyGObject_API->flags_add_constants)
#define pyg_constant_strip_prefix (_PyGObject_API->constant_strip_prefix)
#define pyg_error_check (_PyGObject_API->error_check)
-#define pyg_set_thread_block_funcs (_PyGObject_API->set_thread_block_funcs)
#define PyGParamSpec_Type (*_PyGObject_API->paramspec_type)
#define pyg_param_spec_new (_PyGObject_API->paramspec_new)
#define pyg_param_spec_from_object (_PyGObject_API->paramspec_get)
#define PyGFlags_Type (*_PyGObject_API->flags_type)
#define pyg_flags_add (_PyGObject_API->flags_add)
#define pyg_flags_from_gtype (_PyGObject_API->flags_from_gtype)
-#define pyg_enable_threads (_PyGObject_API->enable_threads)
-#define pyg_gil_state_ensure (_PyGObject_API->gil_state_ensure)
-#define pyg_gil_state_release (_PyGObject_API->gil_state_release)
#define pyg_register_class_init (_PyGObject_API->register_class_init)
#define pyg_register_interface_info (_PyGObject_API->register_interface_info)
#define pyg_add_warning_redirection (_PyGObject_API->add_warning_redirection)
#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)(); \
- } G_STMT_END
-#define pyg_unblock_threads() G_STMT_START { \
- if (_PyGObject_API->unblock_threads != NULL) \
- (* _PyGObject_API->unblock_threads)(); \
- } G_STMT_END
-
-#define pyg_threads_enabled (_PyGObject_API->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
-
/**
* pygobject_init:
gsize total_read = 0;
GError* error = NULL;
GIOStatus status = G_IO_STATUS_NORMAL;
+ GIOChannel *iochannel = NULL;
if (!PyArg_ParseTuple (args, "Oi:pyg_channel_read", &py_iochannel, &max_count)) {
return NULL;
if (max_count == 0)
return PYGLIB_PyBytes_FromString("");
-
+
+ iochannel = pyg_boxed_get (py_iochannel, GIOChannel);
+
while (status == G_IO_STATUS_NORMAL
&& (max_count == -1 || total_read < max_count)) {
gsize single_read;
buf = PYGLIB_PyBytes_AsString(ret_obj) + total_read;
- pyglib_unblock_threads();
- status = g_io_channel_read_chars(pyg_boxed_get (py_iochannel, GIOChannel),
- buf, buf_size, &single_read, &error);
- pyglib_block_threads();
- if (pyglib_error_check(&error))
+ Py_BEGIN_ALLOW_THREADS;
+ status = g_io_channel_read_chars (iochannel, buf, buf_size, &single_read, &error);
+ Py_END_ALLOW_THREADS;
+
+ if (pyglib_error_check(&error))
goto failure;
total_read += single_read;
{
GType g_type;
- PyObject_GC_UnTrack ( (PyObject *) self);
-
- PyObject_ClearWeakRefs ( (PyObject *) self);
-
if ( ( (PyGBoxed *) self)->free_on_dealloc) {
if (self->slice_allocated) {
g_slice_free1 (self->size, ( (PyGBoxed *) self)->boxed);
}
g_base_info_unref (interface_info);
+ break;
}
default:
*(ffi_arg *) retval = (ffi_arg) arg.v_pointer;
break;
} else if (interface_type == GI_INFO_TYPE_ENUM ||
interface_type == GI_INFO_TYPE_FLAGS) {
- g_args[i].v_double = * (double *) args[i];
+ g_args[i].v_uint = * (guint *) args[i];
g_base_info_unref (interface);
break;
} else if (interface_type == GI_INFO_TYPE_STRUCT ||
static void
_base_info_dealloc (PyGIBaseInfo *self)
{
- PyObject_GC_UnTrack ( (PyObject *) self);
-
- PyObject_ClearWeakRefs ( (PyObject *) self);
+ if (self->inst_weakreflist != NULL)
+ PyObject_ClearWeakRefs ( (PyObject *) self);
g_base_info_unref (self->info);
Py_TYPE( (PyObject *) self)->tp_free ( (PyObject *) self);
}
-static int
-_base_info_traverse (PyGIBaseInfo *self,
- visitproc visit,
- void *arg)
-{
- return 0;
-}
-
static PyObject *
_base_info_repr (PyGIBaseInfo *self)
{
}
self->info = g_base_info_ref (info);
+ self->inst_weakreflist = NULL;
+ self->cache = NULL;
return (PyObject *) self;
}
PyGIBaseInfo_Type.tp_dealloc = (destructor) _base_info_dealloc;
PyGIBaseInfo_Type.tp_repr = (reprfunc) _base_info_repr;
- PyGIBaseInfo_Type.tp_flags = (Py_TPFLAGS_DEFAULT |
- Py_TPFLAGS_BASETYPE |
- Py_TPFLAGS_HAVE_GC);
- PyGIBaseInfo_Type.tp_traverse = (traverseproc) _base_info_traverse;
+ PyGIBaseInfo_Type.tp_flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE);
PyGIBaseInfo_Type.tp_weaklistoffset = offsetof(PyGIBaseInfo, inst_weakreflist);
PyGIBaseInfo_Type.tp_methods = _PyGIBaseInfo_methods;
PyGIBaseInfo_Type.tp_richcompare = (richcmpfunc)_base_info_richcompare;
error = NULL;
- pyg_begin_allow_threads;
+ Py_BEGIN_ALLOW_THREADS;
/* FIXME: use this for now but we can streamline the calls */
if (cache->function_type == PYGI_FUNCTION_TYPE_VFUNC)
cache->n_to_py_args,
&state->return_arg,
&error);
- pyg_end_allow_threads;
+ Py_END_ALLOW_THREADS;
if (!retval) {
g_assert (error != NULL);
(PyObject *) self,
&PyGIStructInfo_Type);
- PyObject_GC_UnTrack ( (PyObject *) self);
-
- PyObject_ClearWeakRefs ( (PyObject *) self);
-
if (info != NULL && g_struct_info_is_foreign ( (GIStructInfo *) info)) {
pygi_struct_foreign_release (info, ( (PyGPointer *) self)->pointer);
} else if (self->free_on_dealloc) {
# Skip bases without __info__ (static _gobject._gobject.GObject)
if base is GInterface or\
not issubclass(base, GInterface) or\
- not hasattr(base, '__info__') or\
- not isinstance(base.__info__, InterfaceInfo):
+ not hasattr(base, '__info__'):
continue
- for vfunc in base.__info__.get_vfuncs():
- if vfunc.get_name() == vfunc_name:
- return vfunc
+ # Only look at this classes vfuncs if it is an interface.
+ if isinstance(base.__info__, InterfaceInfo):
+ for vfunc in base.__info__.get_vfuncs():
+ if vfunc.get_name() == vfunc_name:
+ return vfunc
+ # Recurse into the parent classes
vfunc = find_vfunc_info_in_interface(base.__bases__, vfunc_name)
if vfunc is not None:
return vfunc
def do_method_with_default_implementation(self, int8):
self.val = int8
+ def do_vfunc_return_value_only(self):
+ return 2121
+
class Interface3Impl(GObject.Object, GIMarshallingTests.Interface3):
def __init__(self):
GObject.Object.__init__(self)
object_.method_with_default_implementation(87)
self.assertEqual(object_.val, 87)
+ def test_subobject_child_vfunc(self):
+ object_ = self.SubObject(int=1)
+ self.assertEqual(object_.vfunc_return_value_only(), 2121)
+
def test_dynamic_module(self):
from gi.module import DynamicModule
self.assertTrue(isinstance(GObject, DynamicModule))
GIMarshallingTests.test_interface_test_int8_in(instance, 42)
self.assertEqual(instance.val, 42)
+ def test_subclass_override(self):
+ class TestInterfaceImplD(TestInterfaces.TestInterfaceImpl):
+ val2 = None
+
+ def do_test_int8_in(self, int8):
+ self.val2 = int8
+
+ instance = TestInterfaceImplD()
+ self.assertEqual(instance.val, None)
+ self.assertEqual(instance.val2, None)
+
+ GIMarshallingTests.test_interface_test_int8_in(instance, 42)
+ self.assertEqual(instance.val, None)
+ self.assertEqual(instance.val2, 42)
+
def test_mro(self):
# there was a problem with Python bailing out because of
# http://en.wikipedia.org/wiki/Diamond_problem with interfaces,