+commit 7e154cf01cf0ce7a8b52c45ba4db755f73b45d1d
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Mon Sep 17 22:48:13 2012 +0200
+
+ release 3.3.92
+
+ NEWS | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+commit adbe30dc72b4d88bb31055f6ee33fddf32638af9
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Mon Sep 17 22:32:55 2012 +0200
+
+ release-news: Generate HTML changelog
+
+ In addition to producing a NEWS paragraph from the changelog,
+ generate a
+ changelog HTML which can be put into blog announcements.
+
+ Update HACKING to point this out, too.
+
+ HACKING | 2 +-
+ Makefile.am | 22 ++++++++++++++++------
+ 2 files changed, 17 insertions(+), 7 deletions(-)
+
+commit be4a0682bdd189ee908ab1961001f759a80e133c
+Author: Simon Feltman <s.feltman@gmail.com>
+Date: Sun Sep 16 17:27:25 2012 -0700
+
+ [API add] Add ObjectInfo.get_abstract method
+
+ Adds exposure of g_object_info_get_abstract to python for
+ helping with analysis of non-constructable objects from
+ within python.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=675581
+
+ gi/pygi-info.c | 8 ++++++++
+ tests/test_gi.py | 12 ++++++++++++
+ 2 files changed, 20 insertions(+)
+
+commit 3ada408434860d0c8eee6c6a869b5a3d801cfbc8
+Author: Simon Feltman <s.feltman@gmail.com>
+Date: Thu Sep 13 20:53:22 2012 -0700
+
+ Add deprecation warning when setting gpointers to anything other
+ than int.
+
+ This is a first pass which does not change anything except add
+ a warning
+ when anything other than an int is set on a gpointer on a boxed type.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=683599
+
+ gi/pygi-info.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+commit a047f61f26d9c78b82d22948199313e5a389e918
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Mon Sep 17 09:41:24 2012 +0200
+
+ test_properties: Test accessing a property from a superclass
+
+ We already cover accessing the superclass' property if that was
+ defined in
+ Python. Add a corresponding test case for a property defined in C.
+
+ See https://bugzilla.gnome.org/show_bug.cgi?id=684058
+
+ tests/test_properties.py | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+commit 3e6a4000cbc4b0cb503fcd89b50202ed0b70d3a7
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Mon Sep 17 09:31:05 2012 +0200
+
+ test_properties.py: Consistent test names
+
+ Use underscore style method/test case names consistently. Also rename
+ some test
+ cases to better describe what they do.
+
+ tests/test_properties.py | 78
+ +++++++++++++++++++++++-----------------------
+ 1 file changed, 39 insertions(+), 39 deletions(-)
+
+commit 4069c3d8547f35437e0cee175a5912febe25326d
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Wed Sep 12 06:51:24 2012 +0200
+
+ test_everything: Ensure TestSignals callback does get called
+
+ tests/test_everything.py | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit 4e4c87e3868948743e0446abe2ba0cf5626374c4
+Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
+Date: Fri Sep 7 17:17:09 2012 -0400
+
+ argument: Fix 64bit integer convertion from GValue
+
+ Trying to get a 64bit integer using the wrong getter was resulting
+ in an
+ assertion and 0 being returned.
+
+ Co-Authored-By: Martin Pitt <martinpitt@gnome.org>
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=683596
+
+ gi/pygi-argument.c | 8 +++++--
+ tests/test_everything.py | 52
+ ++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 58 insertions(+), 2 deletions(-)
+
+commit e474ce243ea7a58358af344ccadb1418f4d2c8eb
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Tue Sep 11 12:32:10 2012 +0200
+
+ Add Simon Feltman as a project maintainer
+
+ Signed-off-By: Martin Pitt <martinpitt@gnome.org>
+ Signed-off-By: Paolo Borelli <pborelli@gnome.org>
+
+ pygobject.doap | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+commit ee1fc78258f10e8a7872ee3da6c9ad6e7984706e
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Tue Sep 11 10:17:50 2012 +0200
+
+ test_signals.py: Drop global type variables
+
+ Just use the real types and flags from GObject instead of redefining
+ aliases
+ for them. They weren't used consistently, make the tests harder to
+ read, and we
+ really do not want global single-letter variables like "f" and "l".
+
+ tests/test_signal.py | 38 ++++++++++++++++----------------------
+ 1 file changed, 16 insertions(+), 22 deletions(-)
+
+commit 3688cf6efe7161585b943cfaafcfd4610b7ad768
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Tue Sep 11 10:11:58 2012 +0200
+
+ test_signals.py: Consistent test names
+
+ Use underscore style method/test case names consistently.
+
+ tests/test_signal.py | 88
+ +++++++++++++++++++++++++-------------------------
+ 1 file changed, 44 insertions(+), 44 deletions(-)
+
+commit 4559247553b792db956f69c9674c12344d719c82
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Tue Sep 11 09:43:14 2012 +0200
+
+ Add test cases for GValue signal arguments
+
+ These cover various types, (u)int(64) and string.
+
+ Keep the test case for implicit int64 GValues disabled, as this
+ currently does
+ not work and it is not clear whether it should:
+ https://bugzilla.gnome.org/show_bug.cgi?id=683775
+
+ tests/test_signal.py | 41 +++++++++++++++++++++++++++++++++++++++++
+ tests/testhelpermodule.c | 17 +++++++++++++++++
+ 2 files changed, 58 insertions(+)
+
+commit fddb01b0b71b68d154d130cf40fd5f38647b1a4d
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Tue Sep 11 09:31:18 2012 +0200
+
+ Add test for GValue signal return values
+
+ Another attempt to reproduce the reported error in
+ https://bugzilla.gnome.org/show_bug.cgi?id=683596
+ but this works already.
+
+ tests/test_signal.py | 13 +++++++++++++
+ tests/testhelpermodule.c | 36 ++++++++++++++++++++++++++++++++++++
+ 2 files changed, 49 insertions(+)
+
+commit 4f77c7798563ea436ff5b6306a987f03de50b211
+Author: Simon Feltman <s.feltman@gmail.com>
+Date: Fri Sep 7 02:32:15 2012 -0700
+
+ Improve setting pointer fields/arguments to NULL using None
+
+ Setting gi pointers will set them to the address of the python object.
+ This is good except in the case of None which should be used to NULL
+ the pointer out as a special case.
+
+ Commit 21b1d17d2a already fixed this. This improved patch
+ does that in a cleaner and safer way and adds more comments.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=683150
+
+ gi/pygi-argument.c | 8 +-------
+ gi/pygi-info.c | 14 +++++++++++++-
+ 2 files changed, 14 insertions(+), 8 deletions(-)
+
+commit 15046b5a11f6c58a3e5a9c50cf0ce7f31f2cd55f
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Mon Sep 10 16:46:30 2012 +0200
+
+ Test gint64 C signal arguments and return values
+
+ tests/test_signal.py | 12 ++++++++++++
+ tests/testhelpermodule.c | 14 ++++++++++++++
+ 2 files changed, 26 insertions(+)
+
+commit 822d9e07a95f706a40f64335765293542787da90
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Mon Sep 10 16:29:32 2012 +0200
+
+ Test in/out int64 GValue method arguments.
+
+ See https://bugzilla.gnome.org/show_bug.cgi?id=683596
+
+ tests/test_gi.py | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+commit 2d83e52233812618493af4b165615e8741ba41c8
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Wed Sep 5 08:54:53 2012 +0200
+
+ Bump g-i dependency to 1.33.10
+
+ To ensure we have all the Regress test APIs that we use.
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 6a4f4dc9a3d21c3ac8a0aa51432fb8952b4e1ebf
+Author: Thibault Saunier <thibault.saunier@collabora.com>
+Date: Wed Aug 8 12:57:41 2012 -0400
+
+ Fix -uninstalled.pc.in file
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=683379
+
+ pygobject-3.0-uninstalled.pc.in | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+commit d8f1398dbc7fa7803639c542a607f24f18614ad6
+Author: Martin Pitt <martinpitt@gnome.org>
+Date: Mon Sep 3 22:16:47 2012 +0200
+
+ post-release bump to 3.3.92
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
commit ea992324b8197b2d04ff2849b9ab46f8a04b4ed7
Author: Martin Pitt <martinpitt@gnome.org>
Date: Mon Sep 3 22:04:01 2012 +0200
release-news:
printf "%-8s%s\n" "$(VERSION)" "`LC_TIME=C date '+%d-%b-%Y'`" > NEWS.tmp
- last=`head -n1 NEWS | cut -f1 -d' '`; \
- git log --format='format: - %s (%aN)%n%b' $$last.. | \
- sed -n '/^ -/ p; /bugzilla.gnome.org/ { s/^.*id=\([0-9]\+\).*$$/ (#\1)/; p}' >> NEWS.tmp
- echo >> NEWS.tmp
- cat NEWS >> NEWS.tmp
- mv NEWS.tmp NEWS
+
+ @echo -e "\n\n\nFor blogging, you can copy&paste this HTML formatted news:"
+ @echo "-------------- 8< -------------"
+ @last=`head -n1 NEWS | cut -f1 -d' '`; \
+ echo "<ul>"; \
+ for commit in `git rev-list $$last..`; do \
+ data=`git log --format="format:%s%n%an%n%b" $$commit^..$$commit`; \
+ echo "$$data" | perl -e '$$subj = <>; chomp $$subj; $$author = <>; chomp $$author; while (<>) { if (/bugzilla.gnome.org.*id=([0-9]+)/) { $$bug = $$1 }}; print " <li>$$subj ($$author)"; if ($$bug) { print " (<a href=\"https://bugzilla.gnome.org/show_bug.cgi?id=$$bug\">#$$bug</a>)"; }; print "</li>\n"'; \
+ echo "$$data" | perl -e '$$subj = <>; chomp $$subj; $$author = <>; chomp $$author; while (<>) { if (/bugzilla.gnome.org.*id=([0-9]+)/) { $$bug = $$1 }}; print " - $$subj ($$author)"; if ($$bug) { print " (#$$bug)"; }; print "\n"' >> NEWS.tmp; \
+ done
+ @echo "</ul>"
+ @echo "-------------- 8< -------------"
+
+ @echo >> NEWS.tmp
+ @cat NEWS >> NEWS.tmp
+ @mv NEWS.tmp NEWS
.PHONY: ChangeLog release-news
release-news:
printf "%-8s%s\n" "$(VERSION)" "`LC_TIME=C date '+%d-%b-%Y'`" > NEWS.tmp
- last=`head -n1 NEWS | cut -f1 -d' '`; \
- git log --format='format: - %s (%aN)%n%b' $$last.. | \
- sed -n '/^ -/ p; /bugzilla.gnome.org/ { s/^.*id=\([0-9]\+\).*$$/ (#\1)/; p}' >> NEWS.tmp
- echo >> NEWS.tmp
- cat NEWS >> NEWS.tmp
- mv NEWS.tmp NEWS
+
+ @echo -e "\n\n\nFor blogging, you can copy&paste this HTML formatted news:"
+ @echo "-------------- 8< -------------"
+ @last=`head -n1 NEWS | cut -f1 -d' '`; \
+ echo "<ul>"; \
+ for commit in `git rev-list $$last..`; do \
+ data=`git log --format="format:%s%n%an%n%b" $$commit^..$$commit`; \
+ echo "$$data" | perl -e '$$subj = <>; chomp $$subj; $$author = <>; chomp $$author; while (<>) { if (/bugzilla.gnome.org.*id=([0-9]+)/) { $$bug = $$1 }}; print " <li>$$subj ($$author)"; if ($$bug) { print " (<a href=\"https://bugzilla.gnome.org/show_bug.cgi?id=$$bug\">#$$bug</a>)"; }; print "</li>\n"'; \
+ echo "$$data" | perl -e '$$subj = <>; chomp $$subj; $$author = <>; chomp $$author; while (<>) { if (/bugzilla.gnome.org.*id=([0-9]+)/) { $$bug = $$1 }}; print " - $$subj ($$author)"; if ($$bug) { print " (#$$bug)"; }; print "\n"' >> NEWS.tmp; \
+ done
+ @echo "</ul>"
+ @echo "-------------- 8< -------------"
+
+ @echo >> NEWS.tmp
+ @cat NEWS >> NEWS.tmp
+ @mv NEWS.tmp NEWS
.PHONY: ChangeLog release-news
+3.3.92 17-Sep-2012
+ - [API add] Add ObjectInfo.get_abstract method (Simon Feltman) (#675581)
+ - Add deprecation warning when setting gpointers to anything other than
+ int. (Simon Feltman) (#683599)
+ - argument: Fix 64bit integer convertion from GValue (Nicolas Dufresne)
+ (#683596)
+ - Improve setting pointer fields/arguments to NULL using None
+ (Simon Feltman) (#683150)
+ - Bump g-i dependency to 1.33.10 (Martin Pitt)
+ - Fix -uninstalled.pc.in file (Thibault Saunier) (#683379)
+ - Various test suite additions and improvements (Martin Pitt)
+
3.3.91 03-Sep-2012
- Fix exception test case for Python 2 (Martin Pitt)
- Bump g-i dependency to >= 1.3.9 (Martin Pitt)
Metadata-Version: 1.0
Name: PyGObject
-Version: 3.3.91
+Version: 3.3.92
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.3/pygobject-3.3.91.tar.gz
+Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.3/pygobject-3.3.92.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.69 for pygobject 3.3.91.
+# Generated by GNU Autoconf 2.69 for pygobject 3.3.92.
#
# 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.3.91'
-PACKAGE_STRING='pygobject 3.3.91'
+PACKAGE_VERSION='3.3.92'
+PACKAGE_STRING='pygobject 3.3.92'
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.3.91 to adapt to many kinds of systems.
+\`configure' configures pygobject 3.3.92 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.3.91:";;
+ short | recursive ) echo "Configuration of pygobject 3.3.92:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-pygobject configure 3.3.91
+pygobject configure 3.3.92
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.3.91, which was
+It was created by pygobject $as_me 3.3.92, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
PYGOBJECT_MINOR_VERSION=3
-$as_echo "#define PYGOBJECT_MICRO_VERSION 91" >>confdefs.h
+$as_echo "#define PYGOBJECT_MICRO_VERSION 92" >>confdefs.h
-PYGOBJECT_MICRO_VERSION=91
+PYGOBJECT_MICRO_VERSION=92
ac_config_headers="$ac_config_headers config.h"
# Define the identity of the package.
PACKAGE='pygobject'
- VERSION='3.3.91'
+ VERSION='3.3.92'
cat >>confdefs.h <<_ACEOF
Report bugs to <bug-libtool@gnu.org>."
lt_cl_version="\
-pygobject config.lt 3.3.91
+pygobject config.lt 3.3.92
configured by $0, generated by GNU Autoconf 2.69.
Copyright (C) 2011 Free Software Foundation, Inc.
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.31.0
- gobject-introspection-1.0 >= 1.33.9
+ gobject-introspection-1.0 >= 1.33.10
\""; } >&5
($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.31.0
- gobject-introspection-1.0 >= 1.33.9
+ gobject-introspection-1.0 >= 1.33.10
") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_GI_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.31.0
- gobject-introspection-1.0 >= 1.33.9
+ gobject-introspection-1.0 >= 1.33.10
" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.31.0
- gobject-introspection-1.0 >= 1.33.9
+ gobject-introspection-1.0 >= 1.33.10
\""; } >&5
($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.31.0
- gobject-introspection-1.0 >= 1.33.9
+ gobject-introspection-1.0 >= 1.33.10
") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_GI_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.31.0
- gobject-introspection-1.0 >= 1.33.9
+ gobject-introspection-1.0 >= 1.33.10
" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
fi
if test $_pkg_short_errors_supported = yes; then
GI_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.31.0
- gobject-introspection-1.0 >= 1.33.9
+ gobject-introspection-1.0 >= 1.33.10
" 2>&1`
else
GI_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.31.0
- gobject-introspection-1.0 >= 1.33.9
+ gobject-introspection-1.0 >= 1.33.10
" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$GI_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (glib-2.0 >= 2.31.0
- gobject-introspection-1.0 >= 1.33.9
+ gobject-introspection-1.0 >= 1.33.10
) were not met:
$GI_PKG_ERRORS
# 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.3.91, which was
+This file was extended by pygobject $as_me 3.3.92, 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.3.91
+pygobject config.status 3.3.92
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, 3)
-m4_define(pygobject_micro_version, 91)
+m4_define(pygobject_micro_version, 92)
m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version)
dnl versions of packages we require ...
-m4_define(introspection_required_version, 1.33.9)
+m4_define(introspection_required_version, 1.33.10)
m4_define(py2cairo_required_version, 1.2.0)
m4_define(py3cairo_required_version, 1.10.0)
m4_define(glib_required_version, 2.31.0)
switch (type_tag) {
case GI_TYPE_TAG_VOID:
g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
- if (object == Py_None) {
- Py_DECREF(Py_None);
- arg.v_pointer = NULL;
- } else {
- /* This will leak a reference to the python object. */
- arg.v_pointer = object;
- }
+ arg.v_pointer = object == Py_None ? NULL : object;
break;
case GI_TYPE_TAG_BOOLEAN:
{
case GI_TYPE_TAG_INT8:
case GI_TYPE_TAG_INT16:
case GI_TYPE_TAG_INT32:
- case GI_TYPE_TAG_INT64:
arg.v_int = g_value_get_int (value);
break;
+ case GI_TYPE_TAG_INT64:
+ arg.v_int64 = g_value_get_int64 (value);
+ break;
case GI_TYPE_TAG_UINT8:
case GI_TYPE_TAG_UINT16:
case GI_TYPE_TAG_UINT32:
- case GI_TYPE_TAG_UINT64:
arg.v_uint = g_value_get_uint (value);
break;
+ case GI_TYPE_TAG_UINT64:
+ arg.v_uint64 = g_value_get_uint64 (value);
+ break;
case GI_TYPE_TAG_UNICHAR:
arg.v_uint32 = g_value_get_schar (value);
break;
return _get_vfuncs (self, GI_INFO_TYPE_OBJECT);
}
+static PyObject *
+_wrap_g_object_info_get_abstract (PyGIBaseInfo *self)
+{
+ gboolean is_abstract = g_object_info_get_abstract ( (GIObjectInfo*) self->info);
+ return PyBool_FromLong (is_abstract);
+}
+
static PyMethodDef _PyGIObjectInfo_methods[] = {
{ "get_parent", (PyCFunction) _wrap_g_object_info_get_parent, METH_NOARGS },
{ "get_methods", (PyCFunction) _wrap_g_object_info_get_methods, METH_NOARGS },
{ "get_interfaces", (PyCFunction) _wrap_g_object_info_get_interfaces, METH_NOARGS },
{ "get_constants", (PyCFunction) _wrap_g_object_info_get_constants, METH_NOARGS },
{ "get_vfuncs", (PyCFunction) _wrap_g_object_info_get_vfuncs, METH_NOARGS },
+ { "get_abstract", (PyCFunction) _wrap_g_object_info_get_abstract, METH_NOARGS },
{ NULL, NULL, 0 }
};
&& g_type_info_get_tag (field_type_info) == GI_TYPE_TAG_VOID) {
int offset;
+ if (py_value != Py_None && !PYGLIB_PyLong_Check(py_value)) {
+ if (PyErr_WarnEx(PyExc_RuntimeWarning,
+ "Usage of gpointers to store objects has been deprecated. "
+ "Please integer values instead, see: https://bugzilla.gnome.org/show_bug.cgi?id=683599",
+ 1))
+ goto out;
+ }
+
offset = g_field_info_get_offset ((GIFieldInfo *) self->info);
value = _pygi_argument_from_object (py_value, field_type_info, GI_TRANSFER_NOTHING);
+ /* Decrement the previous python object stashed on the void pointer.
+ * This seems somewhat dangerous as the code is blindly assuming any
+ * void pointer field stores a python object pointer and then decrefs it.
+ * This is essentially the same as something like:
+ * Py_XDECREF(struct->void_ptr); */
Py_XDECREF(G_STRUCT_MEMBER (gpointer, pointer, offset));
+
+ /* Assign and increment the newly assigned object. At this point the value
+ * arg will hold a pointer the python object "py_value" or NULL.
+ * This is essentially:
+ * struct->void_ptr = value.v_pointer;
+ * Py_XINCREF(struct->void_ptr);
+ */
G_STRUCT_MEMBER (gpointer, pointer, offset) = (gpointer)value.v_pointer;
- Py_XINCREF(py_value);
+ Py_XINCREF(G_STRUCT_MEMBER (gpointer, pointer, offset));
retval = Py_None;
goto out;
# you can use the --variable=pygobjectincludedir argument to
# pkg-config to get this value. You might want to use this to
# install additional headers.
-pygobjectincludedir=${pc_top_builddir}/${pcfiledir}/gi/_gobject
-overridesdir=${pc_top_builddir}/${pcfiledir}/gi/overrides
+pygobjectincludedir=${pcfiledir}/gi/_gobject
+overridesdir=${pcfiledir}/gi/overrides
Name: PyGObject
Description: Python bindings for GObject
Requires: gobject-2.0
Requires.private: @LIBFFI_PC@
Version: @VERSION@
-Cflags: -I${pc_top_builddir}/${pcfiledir}/gi/_gobject
+Cflags: -I${pcfiledir}/gi/_gobject
def callback(obj, obj_param):
self.assertEqual(obj_param.props.int, 3)
self.assertGreater(obj_param.__grefcount__, 1)
+ obj.called = True
+ obj.called = False
obj.connect('sig-with-obj', callback)
obj.emit_sig_with_obj()
+ self.assertTrue(obj.called)
+
+ def test_int64_param_from_py(self):
+ obj = Everything.TestObj()
+
+ def callback(obj, i):
+ obj.callback_i = i
+ return i
+
+ obj.callback_i = None
+ obj.connect('sig-with-int64-prop', callback)
+ rv = obj.emit('sig-with-int64-prop', GObject.G_MAXINT64)
+ self.assertEqual(rv, GObject.G_MAXINT64)
+ self.assertEqual(obj.callback_i, GObject.G_MAXINT64)
+
+ def test_uint64_param_from_py(self):
+ obj = Everything.TestObj()
+
+ def callback(obj, i):
+ obj.callback_i = i
+ return i
+
+ obj.callback_i = None
+ obj.connect('sig-with-uint64-prop', callback)
+ rv = obj.emit('sig-with-uint64-prop', GObject.G_MAXUINT64)
+ self.assertEqual(rv, GObject.G_MAXUINT64)
+ self.assertEqual(obj.callback_i, GObject.G_MAXUINT64)
+
+ def test_int64_param_from_c(self):
+ obj = Everything.TestObj()
+
+ def callback(obj, i):
+ obj.callback_i = i
+ return i
+
+ obj.callback_i = None
+
+ obj.connect('sig-with-int64-prop', callback)
+ obj.emit_sig_with_int64()
+ self.assertEqual(obj.callback_i, GObject.G_MAXINT64)
+
+ def test_uint64_param_from_c(self):
+ obj = Everything.TestObj()
+
+ def callback(obj, i):
+ obj.callback_i = i
+ return i
+
+ obj.callback_i = None
+
+ obj.connect('sig-with-uint64-prop', callback)
+ obj.emit_sig_with_uint64()
+ self.assertEqual(obj.callback_i, GObject.G_MAXUINT64)
class TestPango(unittest.TestCase):
value.set_int(42)
GIMarshallingTests.gvalue_in(value)
+ def test_gvalue_int64_in(self):
+ value = GObject.Value()
+ value.init(GObject.TYPE_INT64)
+ value.set_int64(GObject.G_MAXINT64)
+ GIMarshallingTests.gvalue_int64_in(value)
+
def test_gvalue_out(self):
self.assertEqual(42, GIMarshallingTests.gvalue_out())
+ def test_gvalue_int64_out(self):
+ self.assertEqual(GObject.G_MAXINT64, GIMarshallingTests.gvalue_int64_out())
+
def test_gvalue_out_caller_allocates(self):
self.assertEqual(42, GIMarshallingTests.gvalue_out_caller_allocates())
self.assertRaises(ValueError, gi.check_version, "99.0.0")
gi.check_version((3, 3, 5))
gi.check_version("3.3.5")
+
+
+class TestObjectInfo(unittest.TestCase):
+ def test_get_abstract_with_abstract(self):
+ repo = gi.gi.Repository.get_default()
+ info = repo.find_by_name('GObject', 'TypeModule')
+ self.assertTrue(info.get_abstract())
+
+ def test_get_abstract_with_concrete(self):
+ repo = gi.gi.Repository.get_default()
+ info = repo.find_by_name('GObject', 'Object')
+ self.assertFalse(info.get_abstract())
type=TYPE_STRV, flags=PARAM_READWRITE | PARAM_CONSTRUCT)
-class TestProperties(unittest.TestCase):
- def testGetSet(self):
+class TestPropertyObject(unittest.TestCase):
+ def test_get_set(self):
obj = PropertyObject()
obj.props.normal = "value"
self.assertEqual(obj.props.normal, "value")
- def testListWithInstance(self):
+ def test_hasattr_on_object(self):
obj = PropertyObject()
self.assertTrue(hasattr(obj.props, "normal"))
- def testListWithoutInstance(self):
+ def test_hasattr_on_class(self):
self.assertTrue(hasattr(PropertyObject.props, "normal"))
- def testSetNoInstance(self):
+ def test_set_on_class(self):
def set(obj):
obj.props.normal = "foobar"
self.assertRaises(TypeError, set, PropertyObject)
- def testIterator(self):
+ def test_iteration(self):
for obj in (PropertyObject.props, PropertyObject().props):
for pspec in obj:
gtype = GType(pspec)
'boxed'])
self.assertEqual(len(obj), 9)
- def testNormal(self):
+ def test_normal(self):
obj = new(PropertyObject, normal="123")
self.assertEqual(obj.props.normal, "123")
obj.set_property('normal', '456')
obj.props.normal = '789'
self.assertEqual(obj.props.normal, "789")
- def testConstruct(self):
+ def test_construct(self):
obj = new(PropertyObject, construct="123")
self.assertEqual(obj.props.construct, "123")
obj.set_property('construct', '456')
obj.props.construct = '789'
self.assertEqual(obj.props.construct, "789")
- def testUTF8(self):
+ def test_utf8(self):
obj = new(PropertyObject, construct_only=UNICODE_UTF8)
self.assertEqual(obj.props.construct_only, TEST_UTF8)
obj.set_property('construct', UNICODE_UTF8)
obj.props.normal = UNICODE_UTF8
self.assertEqual(obj.props.normal, TEST_UTF8)
- def testIntToStr(self):
+ def test_int_to_str(self):
obj = new(PropertyObject, construct_only=1)
self.assertEqual(obj.props.construct_only, '1')
obj.set_property('construct', '2')
obj.props.normal = 3
self.assertEqual(obj.props.normal, '3')
- def testConstructOnly(self):
+ def test_construct_only(self):
obj = new(PropertyObject, construct_only="123")
self.assertEqual(obj.props.construct_only, "123")
self.assertRaises(TypeError,
self.assertRaises(TypeError,
obj.set_property, 'construct-only', '456')
- def testUint64(self):
+ def test_uint64(self):
obj = new(PropertyObject)
self.assertEqual(obj.props.uint64, 0)
obj.props.uint64 = _long(1)
self.assertRaises((TypeError, OverflowError), obj.set_property, "uint64", _long(-1))
self.assertRaises((TypeError, OverflowError), obj.set_property, "uint64", -1)
- def testUInt64DefaultValue(self):
+ def test_uint64_default_value(self):
try:
class TimeControl(GObject.GObject):
__gproperties__ = {
(etype, ex) = sys.exc_info()[2:]
self.fail(str(ex))
- def testEnum(self):
+ def test_enum(self):
obj = new(PropertyObject)
self.assertEqual(obj.props.enum, Gio.SocketType.STREAM)
self.assertEqual(obj.enum, Gio.SocketType.STREAM)
self.assertRaises(TypeError, GObject.Property, type=Gio.SocketType,
default=1)
- def testFlags(self):
+ def test_flags(self):
obj = new(PropertyObject)
self.assertEqual(obj.props.flags, GIMarshallingTests.Flags.VALUE1)
self.assertEqual(obj.flags, GIMarshallingTests.Flags.VALUE1)
self.assertRaises(TypeError, GObject.Property,
type=GIMarshallingTests.Flags, default=None)
- def testGType(self):
+ def test_gtype(self):
obj = new(PropertyObject)
self.assertEqual(obj.props.gtype, TYPE_NONE)
self.assertEqual(obj.props.gtype, TYPE_UINT)
self.assertEqual(obj.gtype, TYPE_UINT)
- def testBoxed(self):
+ def test_boxed(self):
obj = new(PropertyObject)
regex = GLib.Regex.new('[a-z]*', 0, 0)
self.assertRaises(TypeError, setattr, obj, 'boxed', 'foo')
self.assertRaises(TypeError, setattr, obj, 'boxed', object())
- def testStrings(self):
+ def test_strings(self):
obj = new(PropertyObject)
# Should work with actual GStrv objects as well as
self.assertRaises(TypeError, GObject.Property, type=TYPE_STRV,
default=['hello', 1])
- def testRange(self):
+ def test_range(self):
# kiwi code
def max(c):
return 2 ** ((8 * struct.calcsize(c)) - 1) - 1
obj.set_property(key, max)
self.assertEqual(obj.get_property(key), max)
- def testMulti(self):
+ def test_multi(self):
obj = PropertyObject()
obj.set_properties(normal="foo",
uint64=7)
class TestProperty(unittest.TestCase):
- def testSimple(self):
+ def test_simple(self):
class C(GObject.GObject):
str = GObject.Property(type=str)
int = GObject.Property(type=int)
o.long = _long(100)
self.assertEqual(o.long, _long(100))
- def testCustomGetter(self):
+ def test_custom_getter(self):
class C(GObject.GObject):
def get_prop(self):
return 'value'
self.assertEqual(o.prop, 'value')
self.assertRaises(TypeError, setattr, o, 'prop', 'xxx')
- def testCustomSetter(self):
+ def test_custom_setter(self):
class C(GObject.GObject):
def set_prop(self, value):
self._value = value
self.assertEqual(o._value, 'bar')
self.assertRaises(TypeError, getattr, o, 'prop')
- def testDecoratorDefault(self):
+ def test_decorator_default(self):
class C(GObject.GObject):
_value = 'value'
self.assertEqual(o.value, 'blah')
self.assertEqual(o.props.value, 'blah')
- def testDecoratorWithCall(self):
+ def test_decorator_with_call(self):
class C(GObject.GObject):
_value = 1
self.assertEqual(o.typedValue, 5)
self.assertEqual(o.props.typedValue, 5)
- def testErrors(self):
+ def test_errors(self):
self.assertRaises(TypeError, GObject.Property, type='str')
self.assertRaises(TypeError, GObject.Property, nick=False)
self.assertRaises(TypeError, GObject.Property, blurb=False)
self.assertRaises(TypeError, GObject.Property, type=complex)
self.assertRaises(TypeError, GObject.Property, flags=-10)
- def testDefaults(self):
+ def test_defaults(self):
GObject.Property(type=bool, default=True)
GObject.Property(type=bool, default=False)
- def testNameWithUnderscore(self):
+ def test_name_with_underscore(self):
class C(GObject.GObject):
prop_name = GObject.Property(type=int)
o = C()
o.prop_name = 10
self.assertEqual(o.prop_name, 10)
- def testRange(self):
+ def test_range(self):
maxint64 = 2 ** 62 - 1
minint64 = -2 ** 62 - 1
maxuint64 = 2 ** 63 - 1
GObject.Property, type=gtype, minimum=min,
maximum=max + 1)
- def testMinMax(self):
+ def test_min_max(self):
class C(GObject.GObject):
prop_int = GObject.Property(type=int, minimum=1, maximum=100, default=1)
prop_float = GObject.Property(type=float, minimum=0.1, maximum=10.5, default=1.1)
finally:
GLib.log_set_always_fatal(old_mask)
- def testMultipleInstances(self):
+ def test_multiple_instances(self):
class C(GObject.GObject):
prop = GObject.Property(type=str, default='default')
self.assertEqual(o1.prop, 'value')
self.assertEqual(o2.prop, 'default')
- def testObjectProperty(self):
+ def test_object_property(self):
class PropertyObject(GObject.GObject):
obj = GObject.Property(type=GObject.GObject)
pobj1 = pobj2.obj
self.assertEqual(hash(pobj1), obj1_hash)
- def testObjectSubclassProperty(self):
+ def test_object_subclass_property(self):
class ObjectSubclass(GObject.GObject):
__gtype_name__ = 'ObjectSubclass'
PropertyObjectSubclass(obj=ObjectSubclass())
- def testPropertySubclass(self):
+ def test_property_subclass(self):
# test for #470718
class A(GObject.GObject):
prop1 = GObject.Property(type=int)
b.prop1 = 20
self.assertEqual(b.prop1, 20)
- def testPropertySubclassCustomSetter(self):
+ def test_property_subclass_c(self):
+ class A(GIMarshallingTests.PropertiesObject):
+ prop1 = GObject.Property(type=int)
+
+ a = A()
+ a.prop1 = 10
+ self.assertEqual(a.prop1, 10)
+
+ # also has parent properties
+ a.props.some_int = 20
+ self.assertEqual(a.props.some_int, 20)
+
+ def test_property_subclass_custom_setter(self):
# test for #523352
class A(GObject.GObject):
def get_first(self):
self.assertEqual(b.second, 'second')
self.assertRaises(TypeError, setattr, b, 'second', 'foo')
- def testPropertySubclassCustomSetterError(self):
+ def test_property_subclass_custom_setter_error(self):
try:
class A(GObject.GObject):
def get_first(self):
# Bug 644039
- def testReferenceCount(self):
+ def test_reference_count(self):
# We can check directly if an object gets finalized, so we will
# observe it indirectly through the refcount of a member object.
del t
self.assertEqual(sys.getrefcount(o), rc)
- def testDocStringAsBlurb(self):
+ def test_doc_string_as_blurb(self):
class C(GObject.GObject):
@GObject.Property
def blurbed(self):
self.assertEqual(C.blurbed.blurb, 'blurbed doc string')
- def testPythonToGLibTypeMapping(self):
+ def test_python_to_glib_type_mapping(self):
tester = GObject.Property()
self.assertEqual(tester._type_from_python(int), GObject.TYPE_INT)
if sys.version_info < (3, 0):
class TestGPropertyError(unittest.TestCase):
- def testInvalidType(self, *args):
+ def test_invalid_type(self, *args):
def foo():
class Foo(GObject.GObject):
__gproperties__ = None
self.assertRaises(TypeError, foo)
gc.collect()
- def testInvalidName(self, *args):
+ def test_invalid_name(self, *args):
def foo():
class Foo(GObject.GObject):
__gproperties__ = {None: None}
class TestList(unittest.TestCase):
- def testListObject(self):
+ def test_list_names(self):
self.assertEqual(GObject.signal_list_names(C), ('my-signal',))
class TestAccumulator(unittest.TestCase):
- def testAccumulator(self):
+ def test_accumulator(self):
inst = Foo()
inst.connect("my-acc-signal", lambda obj: 1)
inst.connect("my-acc-signal", lambda obj: 2)
retval = inst.emit("my-acc-signal")
self.assertEqual(retval, 3)
- def testAccumulatorTrueHandled(self):
+ def test_accumulator_true_handled(self):
inst = Foo()
inst.connect("my-other-acc-signal", self._true_handler1)
inst.connect("my-other-acc-signal", self._true_handler2)
class TestEmissionHook(unittest.TestCase):
- def testAdd(self):
+ def test_add(self):
self.hook = True
e = E()
e.connect('signal', self._callback)
e.emit('signal')
self.assertEqual(e.status, 3)
- def testRemove(self):
+ def test_remove(self):
self.hook = False
e = E()
e.connect('signal', self._callback)
self.assertEqual(e.status, 1)
e.status = 3
- def testCallbackReturnFalse(self):
+ def test_callback_return_false(self):
self.hook = False
obj = F()
obj.emit('signal')
self.assertEqual(obj.status, 3)
- def testCallbackReturnTrue(self):
+ def test_callback_return_true(self):
self.hook = False
obj = F()
GObject.remove_emission_hook(obj, "signal", hook_id)
self.assertEqual(obj.status, 4)
- def testCallbackReturnTrueButRemove(self):
+ def test_callback_return_true_but_remove(self):
self.hook = False
obj = F()
def _callback(self, e):
self.count += 1
- def testDisconnect(self):
+ def test_disconnect(self):
e = E()
e.connect('signal', self._callback)
e.disconnect_by_func(self._callback)
e.emit('signal')
self.assertEqual(self.count, 0)
- def testHandlerBlock(self):
+ def test_handler_block(self):
e = E()
e.connect('signal', self._callback)
e.handler_block_by_func(self._callback)
e.emit('signal')
self.assertEqual(self.count, 0)
- def testHandlerUnBlock(self):
+ def test_handler_unblock(self):
e = E()
signal_id = e.connect('signal', self._callback)
e.handler_block(signal_id)
e.emit('signal')
self.assertEqual(self.count, 1)
- def testHandlerBlockMethod(self):
+ def test_handler_block_method(self):
# Filed as #375589
class A:
def __init__(self):
class TestSigProp(unittest.TestCase):
- def testEmitInPropertySetter(self):
+ def test_emit_in_property_setter(self):
obj = SigPropClass()
self.assertFalse(obj.signal_emission_failed)
-f = GObject.SignalFlags.RUN_FIRST
-l = GObject.SignalFlags.RUN_LAST
-gfloat = GObject.TYPE_FLOAT
-gdouble = GObject.TYPE_DOUBLE
-guint = GObject.TYPE_UINT
-gulong = GObject.TYPE_ULONG
-
class CM(GObject.GObject):
__gsignals__ = dict(
- test1=(f, None, ()),
- test2=(l, None, (str,)),
- test3=(l, int, (gdouble,)),
- test4=(f, None, (bool, _long, gfloat, gdouble, int, guint, gulong)),
- test_float=(l, gfloat, (gfloat,)),
- test_double=(l, gdouble, (gdouble, )),
- test_string=(l, str, (str, )),
- test_object=(l, object, (object, )),
- test_paramspec=(l, GObject.ParamSpec, ()),
+ test1=(GObject.SignalFlags.RUN_FIRST, None, ()),
+ test2=(GObject.SignalFlags.RUN_LAST, None, (str,)),
+ test3=(GObject.SignalFlags.RUN_LAST, int, (GObject.TYPE_DOUBLE,)),
+ test4=(GObject.SignalFlags.RUN_FIRST, None,
+ (bool, _long, GObject.TYPE_FLOAT, GObject.TYPE_DOUBLE, int,
+ GObject.TYPE_UINT, GObject.TYPE_ULONG)),
+ test_float=(GObject.SignalFlags.RUN_LAST, GObject.TYPE_FLOAT, (GObject.TYPE_FLOAT,)),
+ test_double=(GObject.SignalFlags.RUN_LAST, GObject.TYPE_DOUBLE, (GObject.TYPE_DOUBLE,)),
+ test_int64=(GObject.SignalFlags.RUN_LAST, GObject.TYPE_INT64, (GObject.TYPE_INT64,)),
+ test_string=(GObject.SignalFlags.RUN_LAST, str, (str,)),
+ test_object=(GObject.SignalFlags.RUN_LAST, object, (object,)),
+ test_paramspec=(GObject.SignalFlags.RUN_LAST, GObject.ParamSpec, ()),
+ test_gvalue=(GObject.SignalFlags.RUN_LAST, GObject.Value, (GObject.Value,)),
+ test_gvalue_ret=(GObject.SignalFlags.RUN_LAST, GObject.Value, (GObject.TYPE_GTYPE,)),
)
testprop = GObject.Property(type=int)
self.obj = CM()
testhelper.connectcallbacks(self.obj)
- def testTest1(self):
+ def test_test1(self):
self.obj.emit("test1")
- def testTest2(self):
+ def test_test2(self):
self.obj.emit("test2", "string")
- def testTest3(self):
+ def test_test3(self):
rv = self.obj.emit("test3", 42.0)
self.assertEqual(rv, 20)
- def testTest4(self):
+ def test_test4(self):
self.obj.emit("test4", True, _long(10), 3.14, 1.78, 20, _long(30), _long(31))
- def testTestReturnFloat(self):
+ def test_float(self):
rv = self.obj.emit("test-float", 1.234)
self.assertTrue(rv >= 1.233999 and rv <= 1.2400001, rv)
- def testTestReturnDouble(self):
+ def test_double(self):
rv = self.obj.emit("test-double", 1.234)
self.assertEqual(rv, 1.234)
- def testTestReturnString(self):
+ def test_int64(self):
+ rv = self.obj.emit("test-int64", 102030405)
+ self.assertEqual(rv, 102030405)
+
+ rv = self.obj.emit("test-int64", GObject.G_MAXINT64)
+ self.assertEqual(rv, GObject.G_MAXINT64 - 1)
+
+ rv = self.obj.emit("test-int64", GObject.G_MININT64)
+ self.assertEqual(rv, GObject.G_MININT64)
+
+ def test_string(self):
rv = self.obj.emit("test-string", "str")
self.assertEqual(rv, "str")
- def testTestReturnObject(self):
+ def test_object(self):
rv = self.obj.emit("test-object", self)
self.assertEqual(rv, self)
- def testTestReturnParamSpec(self):
+ def test_paramspec(self):
rv = self.obj.emit("test-paramspec")
self.assertEqual(rv.name, "test-param")
self.assertEqual(rv.nick, "test")
- def testTestParamSpecArgFromC(self):
+ def test_C_paramspec(self):
self.notify_called = False
def cb_notify(obj, prop):
self.obj.set_property("testprop", 42)
self.assertTrue(self.notify_called)
+ def test_gvalue(self):
+ # implicit int
+ rv = self.obj.emit("test-gvalue", 42)
+ self.assertEqual(rv, 42)
+
+ # explicit float
+ v = GObject.Value()
+ v.init(GObject.TYPE_FLOAT)
+ v.set_float(1.234)
+ rv = self.obj.emit("test-gvalue", v)
+ self.assertAlmostEqual(rv, 1.234, 4)
+
+ # implicit float
+ rv = self.obj.emit("test-gvalue", 1.234)
+ self.assertAlmostEqual(rv, 1.234, 4)
+
+ # explicit int64
+ v = GObject.Value()
+ v.init(GObject.TYPE_INT64)
+ v.set_int64(GObject.G_MAXINT64)
+ rv = self.obj.emit("test-gvalue", v)
+ self.assertEqual(rv, GObject.G_MAXINT64)
+
+ # implicit int64
+ # does not work, see https://bugzilla.gnome.org/show_bug.cgi?id=683775
+ #rv = self.obj.emit("test-gvalue", GObject.G_MAXINT64)
+ #self.assertEqual(rv, GObject.G_MAXINT64)
+
+ # explicit uint64
+ v = GObject.Value()
+ v.init(GObject.TYPE_UINT64)
+ v.set_uint64(GObject.G_MAXUINT64)
+ rv = self.obj.emit("test-gvalue", v)
+ self.assertEqual(rv, GObject.G_MAXUINT64)
+
+ # implicit uint64
+ # does not work, see https://bugzilla.gnome.org/show_bug.cgi?id=683775
+ #rv = self.obj.emit("test-gvalue", GObject.G_MAXUINT64)
+ #self.assertEqual(rv, GObject.G_MAXUINT64)
+
+ def test_gvalue_ret(self):
+ self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_INT),
+ GObject.G_MAXINT)
+ self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_UINT),
+ GObject.G_MAXUINT)
+ self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_INT64),
+ GObject.G_MAXINT64)
+ self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_UINT64),
+ GObject.G_MAXUINT64)
+ self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_STRING),
+ "hello")
+
if 'generic-c-marshaller' in GObject.features:
class TestCMarshaller(_TestCMarshaller, unittest.TestCase):
pass
class TestPyGValue(unittest.TestCase):
- def testNoneNULLBoxedConversion(self):
+ def test_none_null_boxed_conversion(self):
class C(GObject.GObject):
__gsignals__ = dict(my_boxed_signal=(
GObject.SignalFlags.RUN_LAST,
def onUnnamed(self, obj):
self.unnamedCalled = True
- def testGetSignalArgs(self):
+ def test_get_signal_args(self):
self.assertEqual(self.Decorated.pushed.get_signal_args(),
(GObject.SignalFlags.RUN_FIRST, None, tuple()))
self.assertEqual(self.Decorated.pulled.get_signal_args(),
self.assertEqual(self.Decorated.stomped.get_signal_args(),
(GObject.SignalFlags.RUN_FIRST, None, (int,)))
- def testClosuresCalled(self):
+ def test_closures_called(self):
decorated = self.Decorated()
self.assertEqual(decorated.value, 0)
decorated.pushed.emit()
decorated.pulled.emit()
self.assertEqual(decorated.value, 0)
- def testSignalCopy(self):
+ def test_signal_copy(self):
blah = self.Decorated.stomped.copy('blah')
self.assertEqual(str(blah), blah)
self.assertEqual(blah.func, self.Decorated.stomped.func)
self.assertEqual(blah.arg_types, self.Decorated.stomped.arg_types)
self.assertEqual(blah.__doc__, self.Decorated.stomped.__doc__)
- def testDocString(self):
+ def test_doc_string(self):
# Test the two techniques for setting doc strings on the signals
# class variables, through the "doc" keyword or as the getter doc string.
self.assertEqual(self.Decorated.stomped.__doc__, 'this will stomp')
self.assertEqual(self.Decorated.pushed.__doc__, 'this will push')
- def testUnnamedSignalGetsNamed(self):
+ def test_unnamed_signal_gets_named(self):
self.assertEqual(str(self.Decorated.unnamed), 'unnamed')
- def testUnnamedSignalGetsCalled(self):
+ def test_unnamed_signal_gets_called(self):
obj = self.Decorated()
obj.connect('unnamed', self.onUnnamed)
self.assertEqual(self.unnamedCalled, False)
obj.emit('unnamed')
self.assertEqual(self.unnamedCalled, True)
- def NOtestOverriddenSignal(self):
+ def NOtest_overridden_signal(self):
# Test that the pushed signal is called in with super and the override
# which should both increment the "value" to 3
obj = self.DecoratedOverride()
self.obj = None
self.value = None
- def onClicked(self, obj, value):
+ def on_clicked(self, obj, value):
self.obj = obj
self.value = value
- def testSignalEmit(self):
+ def test_signal_emit(self):
# standard callback connection with different forms of emit.
obj = self.CustomButton()
- obj.connect('clicked', self.onClicked)
+ obj.connect('clicked', self.on_clicked)
# vanilla
obj.emit('clicked', 1)
self.assertEqual(obj, self.obj)
self.assertEqual(self.value, 1)
- def testSignalClassConnect(self):
+ def test_signal_class_connect(self):
obj = self.CustomButton()
- obj.connect(self.CustomButton.clicked, self.onClicked)
+ obj.connect(self.CustomButton.clicked, self.on_clicked)
obj.emit('clicked', 2)
self.assertEqual(obj, self.obj)
self.assertEqual(self.value, 2)
- def testSignalBoundConnect(self):
+ def test_signal_bound_connect(self):
obj = self.CustomButton()
- obj.clicked.connect(self.onClicked)
+ obj.clicked.connect(self.on_clicked)
obj.emit('clicked', 3)
self.assertEqual(obj, self.obj)
self.assertEqual(self.value, 3)
self.assertTrue('AnnotatedSignalClass' in globals())
self.AnnotatedClass = globals()['AnnotatedSignalClass']
- def testAnnotations(self):
+ def test_annotations(self):
if self.AnnotatedClass:
self.assertEqual(signalhelper.get_signal_annotations(self.AnnotatedClass.sig1.func),
(None, (int, float)))
return d;
}
+static gint64 *
+test_int64_callback (GObject *object, gint64 i)
+{
+ g_return_val_if_fail (G_IS_OBJECT (object), -1);
+
+ if (i == G_MAXINT64)
+ return i-1;
+ return i;
+}
+
static char *
test_string_callback (GObject *object, char *s)
{
return g_param_spec_boolean ("test-param", "test", "test boolean", TRUE, G_PARAM_READABLE);
}
+static GValue *
+test_gvalue_callback (GObject *object, const GValue *v)
+{
+ GValue *ret = g_malloc0 (sizeof (GValue));
+
+ g_return_val_if_fail (G_IS_OBJECT (object), NULL);
+ g_return_val_if_fail (G_IS_VALUE (v), NULL);
+
+ g_value_init (ret, G_VALUE_TYPE (v));
+ g_value_copy (v, ret);
+ return ret;
+}
+
+static GValue *
+test_gvalue_ret_callback (GObject *object, GType type)
+{
+ GValue *ret = g_malloc0 (sizeof (GValue));
+
+ g_return_val_if_fail (G_IS_OBJECT (object), NULL);
+
+ g_value_init (ret, type);
+
+ switch (type) {
+ case G_TYPE_INT:
+ g_value_set_int(ret, G_MAXINT);
+ break;
+ case G_TYPE_INT64:
+ g_value_set_int64(ret, G_MAXINT64);
+ break;
+ case G_TYPE_UINT:
+ g_value_set_uint(ret, G_MAXUINT);
+ break;
+ case G_TYPE_UINT64:
+ g_value_set_uint64(ret, G_MAXUINT64);
+ break;
+ case G_TYPE_STRING:
+ g_value_set_string(ret, "hello");
+ break;
+ default:
+ g_critical ("test_gvalue_ret_callback() does not support type %s", g_type_name (type));
+ }
+
+ return ret;
+}
+
static void
connectcallbacks (GObject *object)
{
"test_double",
G_CALLBACK (test_double_callback),
NULL);
+ g_signal_connect (G_OBJECT (object),
+ "test_int64",
+ G_CALLBACK (test_int64_callback),
+ NULL);
g_signal_connect (G_OBJECT (object),
"test_string",
G_CALLBACK (test_string_callback),
"test_paramspec",
G_CALLBACK (test_paramspec_callback),
NULL);
+ g_signal_connect (G_OBJECT (object),
+ "test_gvalue",
+ G_CALLBACK (test_gvalue_callback),
+ NULL);
+ g_signal_connect (G_OBJECT (object),
+ "test_gvalue_ret",
+ G_CALLBACK (test_gvalue_ret_callback),
+ NULL);
}
static PyObject *