+commit 56ac9339eb1d6950623dc4d8c3b9972874e7fa86
+Author: John (J5) Palmieri <johnp@redhat.com>
+Date: Thu Sep 22 19:03:20 2011 -0400
+
+ when checking instances union members are same type as parent
+
+ * this is so we can support sending Gdk.Event members in place of
+ the Event union into methods
+ * we only support this if the union member has a type of GI_INTERFACE
+ for now
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=659879
+
+ gi/pygi-marshal-from-py.c | 60
+ ++++++++++++++++++++++++++++++++++++++++++---
+ 1 files changed, 56 insertions(+), 4 deletions(-)
+
+commit 311a4f8035a95b41bc3c0a836c32b7a5bf2d9959
+Author: John (J5) Palmieri <johnp@redhat.com>
+Date: Wed Sep 21 21:50:48 2011 -0400
+
+ add a floating flag to pygobjects
+
+ * this allows us to correctly refcount when custom gobjects are
+ instantiated
+ via g_object_new
+
+ gi/_gobject/gobjectmodule.c | 5 +++++
+ gi/_gobject/pygobject-private.h | 3 +++
+ gi/_gobject/pygobject.c | 27 ++++++++++++++++++++++++++-
+ gi/_gobject/pygobject.h | 3 ++-
+ 4 files changed, 36 insertions(+), 2 deletions(-)
+
+commit d2d29ae5845217254b9336fd8629f369cb119b25
+Author: John (J5) Palmieri <johnp@redhat.com>
+Date: Wed Sep 21 21:13:22 2011 -0400
+
+ Revert "Fix refcount bug by not creating python wrapper during
+ gobject init stage"
+
+ This reverts commit f6fa5dd8f39af1b8a52d7600d257400b0983e8c5.
+
+ gi/_gobject/gobjectmodule.c | 32 +++++++++++++++++---------------
+ 1 files changed, 17 insertions(+), 15 deletions(-)
+
+commit a24c10b779f2a1b0425d56d03d59c393389cad98
+Author: John (J5) Palmieri <johnp@redhat.com>
+Date: Wed Sep 21 21:10:00 2011 -0400
+
+ make sure to commit the NEWS file
+
+ NEWS | 4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
commit 2eed2940c9be099fb6305288d895265e6b35d3d2
Author: John (J5) Palmieri <johnp@redhat.com>
Date: Mon Sep 19 13:19:57 2011 -0400
+3.0.1 30-Sep-2011
+ - when checking instances union members are same type as parent
+ - add a floating flag to pygobjects
+ - Revert "Fix refcount bug by not creating python wrapper during gobject init stage"
+
3.0.0 19-Sep-2011
- up version required of gobject-introspection to 1.29.0 (John (J5) Palmieri)
- fix most warnings (John (J5) Palmieri)
Metadata-Version: 1.0
Name: PyGObject
-Version: 3.0.0
+Version: 3.0.1
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.0/pygobject-3.0.0.tar.gz
+Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.0/pygobject-3.0.1.tar.gz
Description: Python bindings for GLib and GObject
Platform: POSIX, Windows
Classifier: Development Status :: 5 - Production/Stable
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for pygobject 3.0.0.
+# Generated by GNU Autoconf 2.68 for pygobject 3.0.1.
#
# 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.0.0'
-PACKAGE_STRING='pygobject 3.0.0'
+PACKAGE_VERSION='3.0.1'
+PACKAGE_STRING='pygobject 3.0.1'
PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject'
PACKAGE_URL=''
# 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.0.0 to adapt to many kinds of systems.
+\`configure' configures pygobject 3.0.1 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.0.0:";;
+ short | recursive ) echo "Configuration of pygobject 3.0.1:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-pygobject configure 3.0.0
+pygobject configure 3.0.1
generated by GNU Autoconf 2.68
Copyright (C) 2010 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.0.0, which was
+It was created by pygobject $as_me 3.0.1, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
PYGOBJECT_MINOR_VERSION=0
-$as_echo "#define PYGOBJECT_MICRO_VERSION 0" >>confdefs.h
+$as_echo "#define PYGOBJECT_MICRO_VERSION 1" >>confdefs.h
-PYGOBJECT_MICRO_VERSION=0
+PYGOBJECT_MICRO_VERSION=1
ac_config_headers="$ac_config_headers config.h"
# Define the identity of the package.
PACKAGE='pygobject'
- VERSION='3.0.0'
+ VERSION='3.0.1'
cat >>confdefs.h <<_ACEOF
Report bugs to <bug-libtool@gnu.org>."
lt_cl_version="\
-pygobject config.lt 3.0.0
+pygobject config.lt 3.0.1
configured by $0, generated by GNU Autoconf 2.68.
Copyright (C) 2010 Free Software Foundation, Inc.
# 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.0.0, which was
+This file was extended by pygobject $as_me 3.0.1, which was
generated by GNU Autoconf 2.68. 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.0.0
+pygobject config.status 3.0.1
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
dnl the pygobject version number
m4_define(pygobject_major_version, 3)
m4_define(pygobject_minor_version, 0)
-m4_define(pygobject_micro_version, 0)
+m4_define(pygobject_micro_version, 1)
m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version)
dnl versions of packages we require ...
gpointer g_class)
{
GObject *object = (GObject *) instance;
- PyObject *wrapper;
+ PyObject *wrapper, *args, *kwargs;
wrapper = g_object_get_qdata(object, pygobject_wrapper_key);
if (wrapper == NULL) {
}
}
pygobject_init_wrapper_set(NULL);
+ if (wrapper == NULL) {
+ /* this looks like a python object created through
+ * g_object_new -> we have no python wrapper, so create it
+ * now */
+ PyGILState_STATE state;
+ state = pyglib_gil_state_ensure();
+ wrapper = pygobject_new_full(object, FALSE, g_class);
+
+ /* float the wrapper ref here because we are going to orphan it
+ * so we don't destroy the wrapper. The next call to pygobject_new_full
+ * will take the ref */
+ pygobject_ref_float (wrapper);
+ args = PyTuple_New(0);
+ kwargs = PyDict_New();
+ if (Py_TYPE(wrapper)->tp_init(wrapper, args, kwargs))
+ PyErr_Print();
+
+ Py_DECREF(args);
+ Py_DECREF(kwargs);
+ pyglib_gil_state_release(state);
+ }
}
g_type_class_unref(class);
if (obj) {
- PyObject *empty_args;
- PyObject *empty_kwargs;
- PyGILState_STATE state;
-
pygobject_sink (obj);
self = (PyGObject *) pygobject_new_full((GObject *)obj, FALSE, NULL);
- empty_args = PyTuple_New(0);
- empty_kwargs = PyDict_New();
-
- state = pyglib_gil_state_ensure();
- if (Py_TYPE(self)->tp_init((PyObject *)self, empty_args, empty_kwargs))
- PyErr_Print();
- pyglib_gil_state_release(state);
-
- Py_DECREF(empty_args);
- Py_DECREF(empty_kwargs);
g_object_unref(obj);
} else
self = NULL;
gboolean pyg_gerror_exception_check(GError **error);
+void pygobject_ref_float(PyGObject *self);
+void pygobject_ref_sink(PyGObject *self);
+
/* from pygtype.h */
extern PyTypeObject PyGTypeWrapper_Type;
g_object_unref(self->obj);
}
+/* Called when an custom gobject is initalized via g_object_new instead of
+ its constructor. The next time the wrapper is access via
+ pygobject_new_full it will sink the floating reference instead of
+ adding a new reference and causing a leak */
+
+void
+pygobject_ref_float(PyGObject *self)
+{
+ /* should only be floated once */
+ g_assert(!(self->private_flags.flags & PYGOBJECT_IS_FLOATING_REF));
+
+ self->private_flags.flags |= PYGOBJECT_IS_FLOATING_REF;
+}
+
+/* Called by gobject_new_full, if the floating flag is set remove it, otherwise
+ ref the pyobject */
+void
+pygobject_ref_sink(PyGObject *self)
+{
+ if (self->private_flags.flags & PYGOBJECT_IS_FLOATING_REF)
+ self->private_flags.flags &= ~PYGOBJECT_IS_FLOATING_REF;
+ else
+ Py_INCREF ( (PyObject *) self);
+}
+
/**
* pygobject_register_wrapper:
* @self: the wrapper instance
/* we already have a wrapper for this object -- return it. */
self = (PyGObject *)g_object_get_qdata(obj, pygobject_wrapper_key);
if (self != NULL) {
- Py_INCREF(self);
+ pygobject_ref_sink(self);
} else {
/* create wrapper */
PyGObjectData *inst_data = pyg_object_peek_inst_data(obj);
};
typedef enum {
- PYGOBJECT_USING_TOGGLE_REF = 1 << 0
+ PYGOBJECT_USING_TOGGLE_REF = 1 << 0,
+ PYGOBJECT_IS_FLOATING_REF = 1 << 1
} PyGObjectFlags;
/* closures is just an alias for what is found in the
GType type = iface_cache->g_type;
if (!PyObject_IsInstance (py_arg, iface_cache->py_type)) {
- PyErr_Format (PyExc_TypeError, "Expected a %s, but got %s",
- iface_cache->type_name,
- py_arg->ob_type->tp_name);
- return FALSE;
+ /* wait, we might be a member of a union so manually check */
+ if (info_type == GI_INFO_TYPE_UNION) {
+ gint i;
+ gint n_fields;
+ gboolean is_member = FALSE;
+ GIUnionInfo *union_info = (GIUnionInfo *) iface_cache->interface_info;
+
+ n_fields = g_union_info_get_n_fields (union_info);
+
+ for (i = 0; i < n_fields; i++) {
+ GIFieldInfo *field_info;
+ GITypeInfo *field_type_info;
+
+ field_info = g_union_info_get_field (union_info, i);
+ field_type_info = g_field_info_get_type (field_info);
+
+ /* we can only check if the members are interfaces */
+ if (g_type_info_get_tag (field_type_info) ==
+ GI_TYPE_TAG_INTERFACE) {
+ PyObject *py_type;
+ GIInterfaceInfo *field_iface_info =
+ g_type_info_get_interface(field_type_info);
+
+ py_type = _pygi_type_import_by_gi_info (
+ (GIBaseInfo *) field_iface_info);
+
+ if (PyObject_IsInstance (py_arg, py_type)) {
+ is_member = TRUE;
+ break;
+ }
+
+ Py_XDECREF (py_type);
+ g_base_info_unref ( ( GIBaseInfo *) field_iface_info);
+
+ }
+
+ g_base_info_unref ( ( GIBaseInfo *) field_type_info);
+ g_base_info_unref ( ( GIBaseInfo *) field_info);
+
+ if (is_member)
+ break;
+ }
+
+ if (!is_member) {
+ PyErr_Format (PyExc_TypeError,
+ "Expected a %s, but got %s",
+ iface_cache->type_name,
+ py_arg->ob_type->tp_name);
+ return FALSE;
+ }
+ } else {
+ PyErr_Format (PyExc_TypeError, "Expected a %s, but got %s",
+ iface_cache->type_name,
+ py_arg->ob_type->tp_name);
+ return FALSE;
+ }
}
if (g_type_is_a (type, G_TYPE_BOXED)) {