Imported Upstream version 3.9.1 upstream/3.9.1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 30 Oct 2018 01:20:41 +0000 (10:20 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 30 Oct 2018 01:20:41 +0000 (10:20 +0900)
58 files changed:
ChangeLog
Makefile.in
NEWS
PKG-INFO
README
aclocal.m4
configure
configure.ac
examples/Makefile.in
gi/Makefile.am
gi/Makefile.in
gi/_glib/Makefile.am
gi/_glib/Makefile.in
gi/_glib/glibmodule.c
gi/_glib/pyglib-python-compat.h
gi/_glib/pyglib.c
gi/_glib/pyglib.h
gi/_glib/pygsource.c [deleted file]
gi/_glib/pygsource.h [deleted file]
gi/_gobject/Makefile.am
gi/_gobject/Makefile.in
gi/_gobject/gobjectmodule.c
gi/_gobject/pygflags.c
gi/_gobject/pygobject-private.h
gi/_gobject/pygobject.c
gi/_gobject/pygobject.h
gi/_gobject/pygtype.c
gi/module.py
gi/overrides/GLib.py
gi/overrides/GObject.py
gi/overrides/Gtk.py
gi/overrides/Makefile.in
gi/pygi-argument.c
gi/pygi-cache.c
gi/pygi-info.c
gi/pygi-info.h
gi/pygi-marshal-from-py.c
gi/pygi-marshal-from-py.h
gi/pygi-marshal-to-py.c
gi/pygi-marshal-to-py.h
gi/pygi-property.c
gi/pygi-repository.c
gi/pygi-signal-closure.c
gi/pygi-signal-closure.h
gi/pygi.h
gi/repository/Makefile.in
m4/python.m4
pygi-convert.sh
pygtkcompat/Makefile.in
tests/Makefile.am
tests/Makefile.in
tests/runtests.py
tests/test_everything.py
tests/test_gi.py
tests/test_gobject.py
tests/test_object_marshaling.py
tests/test_overrides_pango.py
tests/test_signal.py

index 4dcf17e08d6075b9a2d63d7b8415bf46f656a6ea..5b8ef9193a5c248b2416fafc9b9e3c400419ea72 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,737 @@
+commit 902bb6685fd9c90c7d81127861a152b0fab4b107
+Author: Martin Pitt <martinpitt@gnome.org>
+Date:   Tue Apr 30 11:49:03 2013 -0700
+
+    release 3.9.1
+
+ NEWS | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 49 insertions(+)
+
+commit f463d7cfaf65e0f3594ec15d897325f84225f1c5
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Sun Apr 28 19:59:35 2013 -0700
+
+    gtk-demo: Wrap description strings at 80 characters
+
+    Wrap trailing demo description strings so they are easier to read
+    in a programming editor. The gtk-demo itself re-wraps this using
+    textwrap and the Gtk.TextView dynamic wrapping.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698547
+
+ demos/gtk-demo/demos/Entry/search_entry.py       |  6 +++---
+ demos/gtk-demo/demos/Icon View/iconviewbasics.py |  8 ++++----
+ demos/gtk-demo/demos/Icon View/iconviewedit.py   |  5 +++--
+ demos/gtk-demo/demos/Tree View/liststore.py      |  5 ++++-
+ demos/gtk-demo/demos/images.py                   |  6 ++++--
+ demos/gtk-demo/demos/menus.py                    | 20
+ ++++++++++++++++----
+ demos/gtk-demo/demos/pickers.py                  |  4 ++--
+ demos/gtk-demo/demos/pixbuf.py                   |  5 +++--
+ demos/gtk-demo/demos/rotatedtext.py              |  6 ++++--
+ 9 files changed, 43 insertions(+), 22 deletions(-)
+
+commit f0d4b963c42ac31d4d17ec0f2271940df2568644
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Sat Apr 27 22:30:35 2013 -0700
+
+    gtk-demo: Use textwrap to reformat description for Gtk.TextView
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698547
+
+ demos/gtk-demo/gtk-demo.py | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+commit ed41e260dcf5745fcc0656412be3c4a520ee20fc
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Sat Apr 27 21:58:28 2013 -0700
+
+    gtk-demo: Use GtkSource.View for showing source code
+
+    Replace manual syntax highlighting of Gtk.TextView with usage of
+    GtkSource.View when available. Fall back to TextView with no
+    hightlighting when GtkSource is not available.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698547
+
+ demos/gtk-demo/gtk-demo.py | 170
+ ++++++++++++---------------------------------
+ 1 file changed, 44 insertions(+), 126 deletions(-)
+
+commit 150104db47ac5ba32758fba0c156adaecc0fbcc0
+Author: Mike Ruprecht <mike.ruprecht@collabora.co.uk>
+Date:   Sun Apr 28 01:40:34 2013 -0500
+
+    Use correct class for GtkEditable's get_selection_bounds() function
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=699096
+
+ gi/overrides/Gtk.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 61663928259f6f48c11f6e43334a62dd2b3eb8e6
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Thu Apr 25 05:27:35 2013 -0700
+
+    Test results of g_base_info_get_name for NULL
+
+    Block against potential NULL result when generating type hint with
+    _g_arg_get_pytype_hint.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698829
+
+ gi/pygi-info.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+commit 0dff1940caf52ea5f1de27cc801ea6d4dab3a446
+Author: Jose Rostagno <joserostagno@vijona.com.ar>
+Date:   Sun Apr 21 19:09:59 2013 -0300
+
+    Remove g_type_init conditional call
+
+    It's deprecated in the glib version we depend on.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698763
+
+ gi/_gobject/gobjectmodule.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+commit c84b071ed8d3b78b4e4a6aef12f5f8bb99bdc107
+Author: Jose Rostagno <joserostagno@vijona.com.ar>
+Date:   Sat Mar 30 20:59:44 2013 -0300
+
+    Update deps versions also in README
+
+    commit f957e33bc1ef2a4175bab85cfcd9b5faf092aa2f missed to update
+    that file
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698763
+
+ README | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit 4f25fa43e1e5c0f3cd22bcdadadb1d731f01fe34
+Author: Jose Rostagno <joserostagno@vijona.com.ar>
+Date:   Sat Mar 30 20:50:35 2013 -0300
+
+    Drop compat code for old python version
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698763
+
+ gi/_glib/pyglib-python-compat.h | 12 ------------
+ 1 file changed, 12 deletions(-)
+
+commit 8104fa04cac2cba74337e6c4b3ecf56fd6cbb80b
+Author: Niklas Koep <niklas.koep@gmail.com>
+Date:   Thu Apr 25 06:14:12 2013 +0200
+
+    Remove duplicate call to _gi.Repository.require()
+
+    repository.require() was called twice in IntrospectionModule's
+    constructor.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698797
+
+ gi/module.py | 1 -
+ 1 file changed, 1 deletion(-)
+
+commit f22b95033c0bcd99e9c70e6f0dc999f5e64b08a6
+Author: Johan Dahlin <johan@gnome.org>
+Date:   Mon Oct 1 03:02:10 2012 -0700
+
+    Add ObjectInfo.get_class_struct()
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=685218
+
+ gi/pygi-info.c   | 15 +++++++++++++++
+ tests/test_gi.py |  4 ++++
+ 2 files changed, 19 insertions(+)
+
+commit 2d34d35e5db06b0eb29cba91d0999b20a5c0b450
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Mon Apr 22 03:43:23 2013 -0700
+
+    Change interpretation of NULL pointer field from None to 0
+
+    The usage of 0 is needed because these fields should generally
+    be used to store integer indices or hashes, not necessarily
+    pointers to actual data.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698366
+
+ gi/pygi-argument.c       | 11 +----------
+ tests/test_everything.py |  5 +++--
+ 2 files changed, 4 insertions(+), 12 deletions(-)
+
+commit 8d61ad38eb90d639da08289c036ae4cb99336c2a
+Author: Sobhan Mohammadpour <sobhanmohammadpour1@yahoo.fr>
+Date:   Fri Mar 8 08:25:58 2013 +0330
+
+    Do not build tests until needed
+
+    Originally by [Alexandre Rostovtsev <tetromino@gmail.com>
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698444
+
+ tests/Makefile.am | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+commit f61f23b999ae6e27ca852753da906de4ab8e6e25
+Author: Kai Willadsen <kai.willadsen@gmail.com>
+Date:   Sun Apr 14 15:16:40 2013 +1000
+
+    pygi-convert: Support toolbar styles
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698477
+
+ pygi-convert.sh | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 7a92ade7ee5fe2f9eb8de2626c34650e2e5c06df
+Author: Kai Willadsen <kai.willadsen@gmail.com>
+Date:   Sun Apr 14 10:54:04 2013 +1000
+
+    pygi-convert: Support new-style constructors for Gio.File
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698477
+
+ pygi-convert.sh | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit 1e8120992dc103ac817351be3c150e6cb25f719f
+Author: Kai Willadsen <kai.willadsen@gmail.com>
+Date:   Sun Apr 14 10:22:55 2013 +1000
+
+    pygi-convert: Add some support for recent manager constructs
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698477
+
+ pygi-convert.sh | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit 17d349f98d62ea7947c1553e0ef7e867301523aa
+Author: Kai Willadsen <kai.willadsen@gmail.com>
+Date:   Sun Apr 14 07:37:24 2013 +1000
+
+    pygi-convert: Check for double quote in require statement
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698477
+
+ pygi-convert.sh | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit cc8bd6bd3fdf99762aa3431ceee347a05f6f3200
+Author: Kai Willadsen <kai.willadsen@gmail.com>
+Date:   Sun Apr 14 07:37:00 2013 +1000
+
+    pygi-convert: Don't transform arbitrary keysym imports
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=698477
+
+ pygi-convert.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 99872a18ed1468b2c85cc7b96a0d12f2ae5167f0
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Thu Apr 11 04:09:59 2013 -0700
+
+    Remove Python keyword escapement in Repository.find_by_name
+
+    Strip trailing underscore from module level items before
+    calling g_irepository_find_by_name. This fixes a problem
+    with GI module level items having the same name as a Python
+    keyword raising an AttributeError during access (Pango.break_).
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=697363
+
+ gi/pygi-info.c                | 32 ++++++++++++++++++++++----------
+ gi/pygi-info.h                |  2 ++
+ gi/pygi-repository.c          | 16 ++++++++++++++++
+ tests/test_overrides_pango.py |  5 +++++
+ 4 files changed, 45 insertions(+), 10 deletions(-)
+
+commit c07404461b126206e369270b56e613f81369c70a
+Author: Daniel Drake <dsd@laptop.org>
+Date:   Mon Mar 18 16:08:09 2013 -0600
+
+    Optimize signal lookup in gi repository
+
+    Now that we have GSignalQuery results available to us when connecting
+    signals, we already know which GType implements the signal in
+    question.
+
+    Therefore there is no need to traverse the class parent hierarchy
+    looking for this, which takes a considerable amount of CPU time.
+
+    There is also no need to canonicalize the signal name; both before
+    and after this patch, by the time we reach this point we have already
+    successfully looked up the signal name as presented from Python.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=696143
+
+ gi/_gobject/pygobject.c  |  5 ++--
+ gi/pygi-signal-closure.c | 59
+ +++++++++++++-----------------------------------
+ gi/pygi-signal-closure.h |  1 +
+ gi/pygi.h                |  4 +++-
+ 4 files changed, 23 insertions(+), 46 deletions(-)
+
+commit e220706b3e4d9fd454613fbfe1e60e7e1da94ae0
+Author: Daniel Drake <dsd@laptop.org>
+Date:   Mon Mar 18 15:38:19 2013 -0600
+
+    Optimize connection of Python-implemented signals
+
+    Like properties, when working with signals we must detect if the
+    signal is implemented in a Python class or if it originates from the
+    gi repository, and act accordingly.
+
+    Asking the gi repository if it can find a signal that is implemented
+    in a Python class (it can't) takes a considerable amount of CPU time.
+
+    Use g_signal_query() to find out which GType implements the signal.
+    Then perform a simple test to see if this type is implemented at the
+    Python level, allowing us to to skip the GI querying in this case.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=696143
+
+ gi/_gobject/pygobject.c | 19 +++++++++++++++----
+ 1 file changed, 15 insertions(+), 4 deletions(-)
+
+commit e91b35d72f93678a79623347dce271148d57046f
+Author: Daniel Drake <dsd@laptop.org>
+Date:   Mon Mar 18 15:24:52 2013 -0600
+
+    Consolidate signal connection code
+
+    This code was repeated 4 times with very little variance;
+    consolidate it and add simple tests to ensure basic coverage.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=696143
+
+ gi/_gobject/pygobject.c  | 129
+ +++++++++++++++--------------------------------
+ tests/test_everything.py |  33 ++++++++++++
+ 2 files changed, 74 insertions(+), 88 deletions(-)
+
+commit cd91e1d5db617d470acbf8c5bc74c11c92f946f6
+Author: Daniel Drake <dsd@laptop.org>
+Date:   Mon Mar 18 15:11:16 2013 -0600
+
+    Fix setting of struct property values
+
+    "goto out" in this context means that an error occurred, but this
+    particular instance was sitting in the "good" codepath.
+
+    Fixes setting of struct property values.
+
+ gi/pygi-property.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+commit 8981ea0422c6837d488311dafe8937593372e736
+Author: Daniel Drake <dsd@laptop.org>
+Date:   Mon Mar 18 14:25:45 2013 -0600
+
+    Optimize property get/set when using GObject.props
+
+    Skip GI repository lookup for properties defined on Python
+    defined GObject types.
+
+    Signed-off-by: Simon Feltman <sfeltman@src.gnome.org>
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=696143
+
+ gi/_gobject/pygobject.c | 37 +++++++++++++++++++------------------
+ 1 file changed, 19 insertions(+), 18 deletions(-)
+
+commit 266e389ff90d982151bae3ac22b9b8b0739f520f
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date:   Sat Apr 13 17:28:26 2013 +0200
+
+    configure.ac: Fix PYTHON_SO with Python3.3
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=696646
+
+ configure.ac | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+commit e54c2d1df3812a1789ee240b0ba71ddf77c2f90a
+Author: Daniel Drake <dsd@laptop.org>
+Date:   Mon Mar 18 14:13:37 2013 -0600
+
+    Simplify registration of custom types
+
+    Use custom quark data to track Python created GTypes.
+
+    Remove previous mechanism to track registration of python-implemented
+    GTypes as it was unused (no custom registration was ever tracked).
+
+    Leave vtable pointer and set to NULL to avoid an ABI break.
+
+    Signed-off-by: Simon Feltman <sfeltman@src.gnome.org>
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=696143
+
+ gi/_gobject/gobjectmodule.c     | 11 +++++--
+ gi/_gobject/pygobject-private.h |  8 ++---
+ gi/_gobject/pygobject.c         |  8 ++---
+ gi/_gobject/pygobject.h         |  9 +++---
+ gi/_gobject/pygtype.c           | 69
+ +++--------------------------------------
+ 5 files changed, 22 insertions(+), 83 deletions(-)
+
+commit 50702a09344825e3a8aa54365d78de807f989d88
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date:   Sat Apr 13 16:04:17 2013 +0200
+
+    pygi-convert.sh: Add GStreamer rules
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=697951
+
+ pygi-convert.sh | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+commit b289176e6b37cb2825bd555cea019b85b68d5c57
+Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date:   Sun Mar 10 15:04:40 2013 +0200
+
+    pygi-convert: Add rule for TreeModelFlags
+
+    Signed-off-by: Simon Feltman <sfeltman@src.gnome.org>
+
+ pygi-convert.sh | 1 +
+ 1 file changed, 1 insertion(+)
+
+commit 09610bf42be76f65d7d2afe1c691f7b4a7c64e5b
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Fri Mar 29 03:20:44 2013 -0700
+
+    Unify interface struct to Python GI marshaling code
+
+    Add pygi_marshal_to_py_interface_struct used for direct gi method
+    call out args and vfunc in args.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c      |  72 ++++++-------------------------
+ gi/pygi-marshal-to-py.c | 112
+ +++++++++++++++++++++++++++++-------------------
+ gi/pygi-marshal-to-py.h |   8 ++++
+ 3 files changed, 91 insertions(+), 101 deletions(-)
+
+commit 6d3a0751e71ee3c37b3bb646723aed75971e5b39
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Thu Mar 28 22:41:51 2013 -0700
+
+    Unify Python interface struct to GI marshaling code
+
+    Add pygi_marshal_from_py_interface_struct used for direct gi method
+    call in args and vfunc out args.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c        |  75 +++++++--------------
+ gi/pygi-cache.c           |  12 +---
+ gi/pygi-marshal-from-py.c | 167
+ +++++++++++++++++++++++++++++-----------------
+ gi/pygi-marshal-from-py.h |  11 +++
+ 4 files changed, 141 insertions(+), 124 deletions(-)
+
+commit 1ea654b4d34e0d119556b232796cd9370b2572f1
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Thu Mar 28 06:17:15 2013 -0700
+
+    Unify Python float and double to GI marshaling code
+
+    Change _pygi_argument_from_object to use the cachers marshalers
+    (_pygi_marshal_from_py_float/double) directly instead of keeping a
+    copy of the code.
+    Refactor _pygi_marshal_from_py_float/double to use a common utility
+    _pygi_py_arg_to_double for initial error checking and conversion.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c        | 26 ++++----------------------
+ gi/pygi-marshal-from-py.c | 42 ++++++++++++++++++++----------------------
+ 2 files changed, 24 insertions(+), 44 deletions(-)
+
+commit 2eb2a712864a1a685d19018e0860cf0da7c5c9ab
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Thu Mar 28 05:29:08 2013 -0700
+
+    Unify filename to Python GI marshaling code
+
+    Change _pygi_argument_to_object to use the cachers marshaler
+    (_pygi_marshal_to_py_filename) directly instead of keeping a
+    copy of the code.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c      | 22 ++--------------------
+ gi/pygi-marshal-to-py.c |  6 ++----
+ 2 files changed, 4 insertions(+), 24 deletions(-)
+
+commit 54aa043d96deb02589e13042a46917405ca53780
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Thu Mar 28 05:20:00 2013 -0700
+
+    Unify utf8 to Python GI marshaling code
+
+    Change _pygi_argument_to_object to use the cachers marshaler
+    (_pygi_marshal_to_py_utf8) directly instead of keeping a
+    copy of the code.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c      | 11 ++++-------
+ gi/pygi-marshal-to-py.c |  4 +---
+ 2 files changed, 5 insertions(+), 10 deletions(-)
+
+commit 03ff41ae4bb83858338d96cc6210092c7fb82464
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Thu Mar 28 05:10:45 2013 -0700
+
+    Unify unichar to Python GI marshaling code
+
+    Change _pygi_argument_to_object to use the cachers marshaler
+    (_pygi_marshal_to_py_unichar) directly instead of keeping a
+    copy of the code.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c | 19 ++-----------------
+ 1 file changed, 2 insertions(+), 17 deletions(-)
+
+commit 594ad084c2cc21cebce209c11740e6d4866b0b82
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Sat Feb 16 19:49:59 2013 -0800
+
+    Unify Python unicode to filename GI marshaling code
+
+    Change _pygi_argument_from_object to use the cachers marshaler
+    (_pygi_marshal_from_py_filename) directly instead of keeping a
+    copy of the code.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c | 30 ++----------------------------
+ 1 file changed, 2 insertions(+), 28 deletions(-)
+
+commit a62e8cdf90f7b03cfc8116125ef3557f9ad08dde
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Sat Feb 16 19:32:54 2013 -0800
+
+    Unify Python unicode to utf8 GI marshaling code
+
+    Change _pygi_argument_from_object to use the cachers marshaler
+    (_pygi_marshal_from_py_utf8) directly instead of keeping a
+    copy of the code.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c | 32 ++------------------------------
+ 1 file changed, 2 insertions(+), 30 deletions(-)
+
+commit e253c73335fccabc61e0329f8528a90f79858c67
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Sat Feb 16 19:16:43 2013 -0800
+
+    Unify Python unicode to unichar GI marshaling code
+
+    Change _pygi_argument_from_object to use the cachers marshaler
+    (_pygi_marshal_from_py_unichar) directly instead of keeping a
+    copy of the code.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=693405
+
+ gi/pygi-argument.c        | 34 ++--------------------------------
+ gi/pygi-marshal-from-py.c |  9 +++++++++
+ 2 files changed, 11 insertions(+), 32 deletions(-)
+
+commit 216caf590b262fed40d10bb34d020089d1197160
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Thu Apr 4 15:57:12 2013 -0700
+
+    Fix enum and flags marshaling type assumptions
+
+    Replace assignments of GFlags and GEnum values to various GIArgument
+    members with v_uint and v_int respectively.
+
+ gi/pygi-argument.c | 6 +++---
+ gi/pygi-property.c | 4 ++--
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+commit 4799ef1d0cb9a4b27c7952585d33b58ea9ec34ca
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date:   Thu Apr 4 10:08:38 2013 +0200
+
+    Make AM_CHECK_PYTHON_LIBS not depend on AM_CHECK_PYTHON_HEADERS
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=696648#c6
+
+ m4/python.m4 | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit f82f755a0f419539c223e4a74e33145726c6e69f
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date:   Thu Apr 4 09:05:48 2013 +0200
+
+    Use distutils.sysconfig to retrieve the python include path.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=696648
+
+ m4/python.m4 | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+commit cf81dd66e6387bf27122a71176e91ca39beb6519
+Author: Martin Pitt <martinpitt@gnome.org>
+Date:   Thu Apr 4 06:47:56 2013 +0200
+
+    Use g_strdup() consistently
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=696650
+
+ gi/pygi-marshal-from-py.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 6c22fea63fa6978c2a717ff12ff84d3aff776b5e
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date:   Tue Mar 26 16:03:59 2013 +0100
+
+    Support PEP 3149 (ABI version tagged .so files)
+
+    Add a ABI suffix to the shared library retrieved from
+    distutils.sysconfig
+    instead of hardcoding it. This should also make things more robust
+    on Windows.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=696646
+
+ configure.ac            |  3 +++
+ gi/Makefile.am          | 14 +++++++-------
+ gi/_glib/Makefile.am    | 14 +++++++-------
+ gi/_gobject/Makefile.am | 14 +++++++-------
+ 4 files changed, 24 insertions(+), 21 deletions(-)
+
+commit 2259ccac8aa2ec23240e92e303ea3f2c53dc2a88
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Sun Mar 31 01:32:34 2013 -0700
+
+    Fix stack corruption due to incorrect format for argument parser
+
+    Fix call to PyArg_ParseTupleAndKeywords that used a format parser
+    of "l" meaning long (8 bytes) in combination with an output pointer
+    of guint (4 bytes). Change to use gulong with a format of "k".
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=696892
+
+ gi/_gobject/pygflags.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+commit 48e52210ece0e144b4c959e773ea542a912358e7
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date:   Thu Mar 7 00:26:37 2013 -0800
+
+    Deprecate GLib and GObject threads_init
+
+    Remove a handful of Python threading related helper functions
+    from pyglib and pygobject. The binding internals required
+    GLib.threads_init to be called for PyGObject to work with
+    Python threads. This was removed as it should not be a requirement.
+    Using the Python threading module already initializes threading
+    for us (PyEval_InitThreads).
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=686914
+
+ gi/_glib/glibmodule.c       | 16 --------
+ gi/_glib/pyglib.c           | 94
+ ---------------------------------------------
+ gi/_glib/pyglib.h           | 28 +++++++-------
+ gi/_gobject/gobjectmodule.c | 31 ++++-----------
+ gi/overrides/GLib.py        |  8 +++-
+ gi/overrides/GObject.py     |  2 +-
+ 6 files changed, 28 insertions(+), 151 deletions(-)
+
+commit 89d05f91cee419d46cb5318d4a9001ec315a3475
+Author: Martin Pitt <martinpitt@gnome.org>
+Date:   Mon Mar 25 09:03:51 2013 +0100
+
+    Drop support for Python 2.6
+
+    2.7 has been released long ago, nobody tests PyGObject with 2.6 any
+    more, and
+    this unblocks e. g. GNOME #682320.
+
+    Drop usage of PyCObject_* (which has been superseded by PyCapsule
+    for >= 2.7),
+    and drop Python 2.6 specific workarounds.
+
+ configure.ac                    |  2 +-
+ gi/_glib/pyglib-python-compat.h | 20 ------------------
+ gi/_gobject/pygobject.h         |  6 ------
+ gi/pygi.h                       |  4 ----
+ m4/python.m4                    |  2 +-
+ tests/runtests.py               | 45
+ +----------------------------------------
+ tests/test_gobject.py           |  1 -
+ tests/test_signal.py            |  4 ----
+ 8 files changed, 3 insertions(+), 81 deletions(-)
+
+commit 56347953abb1e214817186581eaf2b2d8762cf97
+Author: Martin Pitt <martinpitt@gnome.org>
+Date:   Wed Oct 24 16:43:25 2012 +0200
+
+    Remove static PollFD bindings
+
+    Use the GLib API through GI instead, and provide an override to keep a
+    backwards compatible constructor syntax.
+
+    https://bugzilla.gnome.org/show_bug.cgi?id=686795
+
+ gi/_glib/Makefile.am  |  2 --
+ gi/_glib/glibmodule.c |  2 --
+ gi/_glib/pygsource.c  | 98
+ ---------------------------------------------------
+ gi/_glib/pygsource.h  | 36 -------------------
+ gi/overrides/GLib.py  | 17 +++++++--
+ 5 files changed, 15 insertions(+), 140 deletions(-)
+
+commit a93eb5ecc982b5fe1bdf8f78b15ba10351a63b89
+Author: Martin Pitt <martinpitt@gnome.org>
+Date:   Mon Mar 25 08:44:24 2013 +0100
+
+    Drop test skipping due to too old g-i
+
+    We depend on gobject-introspection 1.35.9 now, which has all this API.
+
+ tests/test_gi.py                | 24 ------------------------
+ tests/test_object_marshaling.py | 14 --------------
+ 2 files changed, 38 deletions(-)
+
+commit f957e33bc1ef2a4175bab85cfcd9b5faf092aa2f
+Author: Martin Pitt <martinpitt@gnome.org>
+Date:   Mon Mar 25 08:37:37 2013 +0100
+
+    Bump glib and g-i dependencies
+
+    Now require g-i 1.35.9 and glib 2.35.9, i. e. the current stable
+    GNOME 3.8
+    versions. This allows us to drop the conditional test suite skips
+    and drop the
+    static PollFD bindings.
+
+ configure.ac | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+commit 252556d044322207429c0d0c269365f48e4d819a
+Author: Martin Pitt <martinpitt@gnome.org>
+Date:   Mon Mar 25 08:43:53 2013 +0100
+
+    configure.ac: post-release version bump to 3.9.1
+
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
 commit 5f82e007e2dcdbfd82a20d8c4d54f9cd7b3b77ac
 Author: Martin Pitt <martinpitt@gnome.org>
 Date:   Mon Mar 25 08:12:10 2013 +0100
index 71b842826c86643be39cb0c8d52b30184f8ff487..d248fc3c7d7202ebb8ec195540b6fb7d7e944517 100644 (file)
@@ -272,6 +272,7 @@ PYTHON_LIBS = @PYTHON_LIBS@
 PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
diff --git a/NEWS b/NEWS
index dbe10278b31b58b6248f0e0a9326d4fa0b9ab12c..6ecd4170285715e8eadcf11df11a081954cd9bb4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,52 @@
+3.9.1   30-Apr-2013
+       - gtk-demo: Wrap description strings at 80 characters (Simon Feltman)
+         (#698547)
+       - gtk-demo: Use textwrap to reformat description for Gtk.TextView
+         (Simon Feltman) (#698547)
+       - gtk-demo: Use GtkSource.View for showing source code (Simon Feltman)
+         (#698547)
+       - Use correct class for GtkEditable's get_selection_bounds() function
+         (Mike Ruprecht) (#699096)
+       - Test results of g_base_info_get_name for NULL (Simon Feltman)
+         (#698829)
+       - Add ObjectInfo.get_class_struct() (Johan Dahlin) (#685218)
+       - Change interpretation of NULL pointer field from None to 0
+         (Simon Feltman) (#698366)
+       - Do not build tests until needed (Sobhan Mohammadpour) (#698444)
+       - pygi-convert: Support toolbar styles (Kai Willadsen) (#698477)
+       - pygi-convert: Support new-style constructors for Gio.File
+         (Kai Willadsen) (#698477)
+       - pygi-convert: Add some support for recent manager constructs
+         (Kai Willadsen) (#698477)
+       - pygi-convert: Don't transform arbitrary keysym imports
+         (Kai Willadsen) (#698477)
+       - Remove Python keyword escapement in Repository.find_by_name
+         (Simon Feltman) (#697363)
+       - Optimize signal lookup in gi repository (Daniel Drake) (#696143)
+       - Optimize connection of Python-implemented signals (Daniel Drake)
+         (#696143)
+       - Consolidate signal connection code (Daniel Drake) (#696143)
+       - Fix setting of struct property values (Daniel Drake)
+       - Optimize property get/set when using GObject.props (Daniel Drake)
+         (#696143)
+       - configure.ac: Fix PYTHON_SO with Python3.3 (Christoph Reiter)
+         (#696646)
+       - Simplify registration of custom types (Daniel Drake) (#696143)
+       - pygi-convert.sh: Add GStreamer rules (Christoph Reiter) (#697951)
+       - pygi-convert: Add rule for TreeModelFlags (Jussi Kukkonen)
+       - Unify GI marshalling code (Simon Feltman) (#693405)
+       - Use distutils.sysconfig to retrieve the python include path.
+         (Christoph Reiter) (#696648)
+       - Support PEP 3149 (ABI version tagged .so files) (Christoph Reiter)
+         (#696646)
+       - Fix stack corruption due to incorrect format for argument parser
+         (Simon Feltman) (#696892)
+       - Deprecate GLib and GObject threads_init (Simon Feltman) (#686914)
+       - Drop support for Python 2.6 (Martin Pitt)
+       - Remove static PollFD bindings (Martin Pitt) (#686795)
+       - Drop test skipping due to too old g-i (Martin Pitt)
+       - Bump glib and g-i dependencies (Martin Pitt)
+
 3.8.0   25-Mar-2013
        - tests: Fix incorrect assumption when testing pyglib version
          (Simon Feltman)
index 3badb54cd264661d33e12b7f06ddb4828d266321..ea9c30e2dfc2ecf4f20ddcf6d7d662313ec9b0f1 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: PyGObject
-Version: 3.8.0
+Version: 3.9.1
 Summary: Python bindings for GObject
 Home-page: http://www.pygtk.org/
 Author: James Henstridge
@@ -8,7 +8,7 @@ Author-email: james@daa.com.au
 Maintainer: Johan Dahlin
 Maintainer-email: johan@gnome.org
 License: GNU LGPL
-Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.8/pygobject-3.8.0.tar.gz
+Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.9/pygobject-3.9.1.tar.gz
 Description: Python bindings for GLib and GObject
 Platform: POSIX, Windows
 Classifier: Development Status :: 5 - Production/Stable
diff --git a/README b/README
index 38fd863c7b1cdba7f024ac5548d463a68f11a670..47a4c9df5fbc92870fc2fc1796328ab80a02aaa8 100644 (file)
--- a/README
+++ b/README
@@ -44,8 +44,8 @@ You can subscribe to it through the web interface:
 Requirements
 ============
   * C compiler (GCC and MSVC supported)
-  * Python 2.6 or higher
-  * Glib/Gio 2.34.2 or higher
+  * Python 2.7 or higher
+  * Glib/Gio 2.35.9 or higher
   * libffi (optional)
 
 Copyright Information
index c397c89deacaf014b1c19a53743b52bb81d71188..cbd58f8fc212f34d6836cb116a7ace428bbbe7fa 100644 (file)
@@ -1704,7 +1704,7 @@ AC_DEFUN([GNOME_CODE_COVERAGE],[
                ])
 
                # List of supported lcov versions.
-               lcov_version_list="1.6 1.7 1.8 1.9"
+               lcov_version_list="1.6 1.7 1.8 1.9 1.10"
 
                AC_CHECK_PROG([LCOV], [lcov], [lcov])
                AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
index 19d32dd6edba0d4742a00da98b2bcc06cad1a4ab..502ffe75eff460b68a5900be70426120204dd671 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pygobject 3.8.0.
+# Generated by GNU Autoconf 2.69 for pygobject 3.9.1.
 #
 # Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>.
 #
@@ -591,8 +591,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='pygobject'
 PACKAGE_TARNAME='pygobject'
-PACKAGE_VERSION='3.8.0'
-PACKAGE_STRING='pygobject 3.8.0'
+PACKAGE_VERSION='3.9.1'
+PACKAGE_STRING='pygobject 3.9.1'
 PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject'
 PACKAGE_URL='https://live.gnome.org/PyGObject/'
 
@@ -680,6 +680,7 @@ PLATFORM
 PYTHON_LIB_LOC
 PYTHON_LIBS
 PYTHON_INCLUDES
+PYTHON_SO
 pkgpyexecdir
 pyexecdir
 pkgpythondir
@@ -1394,7 +1395,7 @@ if test "$ac_init_help" = "long"; then
   # 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.8.0 to adapt to many kinds of systems.
+\`configure' configures pygobject 3.9.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1464,7 +1465,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of pygobject 3.8.0:";;
+     short | recursive ) echo "Configuration of pygobject 3.9.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1599,7 +1600,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-pygobject configure 3.8.0
+pygobject configure 3.9.1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1877,7 +1878,7 @@ cat >config.log <<_ACEOF
 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.8.0, which was
+It was created by pygobject $as_me 3.9.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2236,14 +2237,14 @@ $as_echo "#define PYGOBJECT_MAJOR_VERSION 3" >>confdefs.h
 PYGOBJECT_MAJOR_VERSION=3
 
 
-$as_echo "#define PYGOBJECT_MINOR_VERSION 8" >>confdefs.h
+$as_echo "#define PYGOBJECT_MINOR_VERSION 9" >>confdefs.h
 
-PYGOBJECT_MINOR_VERSION=8
+PYGOBJECT_MINOR_VERSION=9
 
 
-$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"
@@ -2754,7 +2755,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='pygobject'
- VERSION='3.8.0'
+ VERSION='3.9.1'
 
 
 cat >>confdefs.h <<_ACEOF
 
         if test -n "$PYTHON"; then
       # If the user set $PYTHON, use it and don't search something else.
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version >= 2.6" >&5
-$as_echo_n "checking whether $PYTHON version >= 2.6... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version >= 2.7" >&5
+$as_echo_n "checking whether $PYTHON version >= 2.7... " >&6; }
       prog="import sys
 # split strings by '.' and convert to numeric.  Append some zeros
 # because we need at least 4 digits for the hex conversion.
 # map returns an iterator in Python 3.0 and a list in 2.x
-minver = list(map(int, '2.6'.split('.'))) + [0, 0, 0]
+minver = list(map(int, '2.7'.split('.'))) + [0, 0, 0]
 minverhex = 0
 # xrange is not present in Python 3.0 and range returns an iterator
 for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i]
     else
       # Otherwise, try each interpreter until we find one that satisfies
       # VERSION.
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 2.6" >&5
-$as_echo_n "checking for a Python interpreter with version >= 2.6... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 2.7" >&5
+$as_echo_n "checking for a Python interpreter with version >= 2.7... " >&6; }
 if ${am_cv_pathless_PYTHON+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
-       for am_cv_pathless_PYTHON in python3 python3.3 python3.2 python3.1 python2 python2.7 python2.6 python none; do
+       for am_cv_pathless_PYTHON in python3 python3.3 python3.2 python3.1 python2 python2.7 python none; do
          test "$am_cv_pathless_PYTHON" = none && break
          prog="import sys
 # split strings by '.' and convert to numeric.  Append some zeros
 # because we need at least 4 digits for the hex conversion.
 # map returns an iterator in Python 3.0 and a list in 2.x
-minver = list(map(int, '2.6'.split('.'))) + [0, 0, 0]
+minver = list(map(int, '2.7'.split('.'))) + [0, 0, 0]
 minverhex = 0
 # xrange is not present in Python 3.0 and range returns an iterator
 for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i]
@@ -12799,6 +12800,12 @@ else
 fi
 fi
 
+# - 'SO' for PyPy, CPython 2.7-3.2
+# - 'EXT_SUFFIX' for CPython3.3+ (http://bugs.python.org/issue16754)
+# - fallback to '.so'
+PYTHON_SO=`$PYTHON -c "import distutils.sysconfig, sys; get = distutils.sysconfig.get_config_var; sys.stdout.write(get('EXT_SUFFIX') or get('SO') or '.so');"`
+
+
 
 
 
@@ -12807,7 +12814,7 @@ fi
 
         # Find any Python interpreter.
     if test -z "$PYTHON"; then
-      for ac_prog in python3 python3.3 python3.2 python3.1 python2 python2.7 python2.6 python
+      for ac_prog in python3 python3.3 python3.2 python3.1 python2 python2.7 python
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -12981,12 +12988,8 @@ if test "x$PYTHON_INCLUDES" = x; then
   if test -x "$PYTHON_CONFIG"; then
     PYTHON_INCLUDES=`$PYTHON_CONFIG --includes 2>/dev/null`
   else
-    py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`
-    py_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`
-    PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
-    if test "$py_prefix" != "$py_exec_prefix"; then
-      PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
-    fi
+    PYTHON_INCLUDES=`$PYTHON -c "import distutils.sysconfig, sys; sys.stdout.write(distutils.sysconfig.get_python_inc(True))"`
+    PYTHON_INCLUDES="-I$PYTHON_INCLUDES"
   fi
 fi
 
@@ -13012,7 +13015,7 @@ if test "x$os_win32" = "xyes"; then
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libraries required to embed python" >&5
 $as_echo_n "checking for libraries required to embed python... " >&6; }
-py_exec_prefix=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
+py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`
 if test "x$PYTHON_LIBS" = x; then
        PYTHON_LIBS="-L${py_prefix}/lib -lpython${PYTHON_VERSION}"
 fi
@@ -13347,7 +13350,7 @@ fi
     PKG_CONFIG=no
   fi
 
-  min_glib_version=2.34.2
+  min_glib_version=2.35.9
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB - version >= $min_glib_version" >&5
 $as_echo_n "checking for GLIB - version >= $min_glib_version... " >&6; }
 
@@ -13692,12 +13695,12 @@ if test -n "$GIO_CFLAGS"; then
     pkg_cv_GIO_CFLAGS="$GIO_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-2.0 >= 2.34.2\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "gio-2.0 >= 2.34.2") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-2.0 >= 2.35.9\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gio-2.0 >= 2.35.9") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_GIO_CFLAGS=`$PKG_CONFIG --cflags "gio-2.0 >= 2.34.2" 2>/dev/null`
+  pkg_cv_GIO_CFLAGS=`$PKG_CONFIG --cflags "gio-2.0 >= 2.35.9" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -13709,12 +13712,12 @@ if test -n "$GIO_LIBS"; then
     pkg_cv_GIO_LIBS="$GIO_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-2.0 >= 2.34.2\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "gio-2.0 >= 2.34.2") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gio-2.0 >= 2.35.9\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gio-2.0 >= 2.35.9") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_GIO_LIBS=`$PKG_CONFIG --libs "gio-2.0 >= 2.34.2" 2>/dev/null`
+  pkg_cv_GIO_LIBS=`$PKG_CONFIG --libs "gio-2.0 >= 2.35.9" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -13735,14 +13738,14 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               GIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gio-2.0 >= 2.34.2" 2>&1`
+               GIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gio-2.0 >= 2.35.9" 2>&1`
         else
-               GIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gio-2.0 >= 2.34.2" 2>&1`
+               GIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gio-2.0 >= 2.35.9" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
        echo "$GIO_PKG_ERRORS" >&5
 
-       as_fn_error $? "Package requirements (gio-2.0 >= 2.34.2) were not met:
+       as_fn_error $? "Package requirements (gio-2.0 >= 2.35.9) were not met:
 
 $GIO_PKG_ERRORS
 
@@ -13792,17 +13795,17 @@ if test -n "$GI_CFLAGS"; then
     pkg_cv_GI_CFLAGS="$GI_CFLAGS"
  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.34.2
-    gobject-introspection-1.0 >= 1.34.2
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.35.9
+    gobject-introspection-1.0 >= 1.35.9
 \""; } >&5
-  ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.34.2
-    gobject-introspection-1.0 >= 1.34.2
+  ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.35.9
+    gobject-introspection-1.0 >= 1.35.9
 ") 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.34.2
-    gobject-introspection-1.0 >= 1.34.2
+  pkg_cv_GI_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.35.9
+    gobject-introspection-1.0 >= 1.35.9
 " 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
@@ -13815,17 +13818,17 @@ if test -n "$GI_LIBS"; then
     pkg_cv_GI_LIBS="$GI_LIBS"
  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.34.2
-    gobject-introspection-1.0 >= 1.34.2
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.35.9
+    gobject-introspection-1.0 >= 1.35.9
 \""; } >&5
-  ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.34.2
-    gobject-introspection-1.0 >= 1.34.2
+  ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.35.9
+    gobject-introspection-1.0 >= 1.35.9
 ") 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.34.2
-    gobject-introspection-1.0 >= 1.34.2
+  pkg_cv_GI_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.35.9
+    gobject-introspection-1.0 >= 1.35.9
 " 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
@@ -13847,19 +13850,19 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               GI_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.34.2
-    gobject-introspection-1.0 >= 1.34.2
+               GI_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.35.9
+    gobject-introspection-1.0 >= 1.35.9
 " 2>&1`
         else
-               GI_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.34.2
-    gobject-introspection-1.0 >= 1.34.2
+               GI_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.35.9
+    gobject-introspection-1.0 >= 1.35.9
 " 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.34.2
-    gobject-introspection-1.0 >= 1.34.2
+       as_fn_error $? "Package requirements (glib-2.0 >= 2.35.9
+    gobject-introspection-1.0 >= 1.35.9
 ) were not met:
 
 $GI_PKG_ERRORS
@@ -14367,7 +14370,7 @@ $as_echo "$enable_code_coverage" >&6; }
 fi
 
                # List of supported lcov versions.
-               lcov_version_list="1.6 1.7 1.8 1.9"
+               lcov_version_list="1.6 1.7 1.8 1.9 1.10"
 
                # Extract the first word of "lcov", so it can be a program name with args.
 set dummy lcov; ac_word=$2
@@ -15264,7 +15267,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # 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.8.0, which was
+This file was extended by pygobject $as_me 3.9.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -15331,7 +15334,7 @@ _ACEOF
 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.8.0
+pygobject config.status 3.9.1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index 6ad40599be582ade997d21fe0508d5c1329fea9f..2458975e435cb7bf0c764edb4571dc16003b1714 100644 (file)
@@ -12,21 +12,21 @@ AC_PREREQ([2.68])
 # You can also build against a full interpreter path, such as
 #   $ ./configure --with-python=~/my-patched-python/python
 
-m4_define(python_min_ver, 2.6)
+m4_define(python_min_ver, 2.7)
 m4_define(python3_min_ver, 3.1)
 
 dnl the pygobject version number
 m4_define(pygobject_major_version, 3)
-m4_define(pygobject_minor_version, 8)
-m4_define(pygobject_micro_version, 0)
+m4_define(pygobject_minor_version, 9)
+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 ...
-m4_define(introspection_required_version, 1.34.2)
+m4_define(introspection_required_version, 1.35.9)
 m4_define(py2cairo_required_version, 1.2.0)
 m4_define(py3cairo_required_version, 1.10.0)
-m4_define(glib_required_version, 2.34.2)
-m4_define(gio_required_version, 2.34.2)
+m4_define(glib_required_version, 2.35.9)
+m4_define(gio_required_version, 2.35.9)
 
 AC_INIT([pygobject],[pygobject_version],
        [http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject],
@@ -111,6 +111,12 @@ if test $build_py3k = true ; then
                          [AC_MSG_ERROR(too old)])
 fi
 
+# - 'SO' for PyPy, CPython 2.7-3.2
+# - 'EXT_SUFFIX' for CPython3.3+ (http://bugs.python.org/issue16754)
+# - fallback to '.so'
+PYTHON_SO=`$PYTHON -c "import distutils.sysconfig, sys; get = distutils.sysconfig.get_config_var; sys.stdout.write(get('EXT_SUFFIX') or get('SO') or '.so');"`
+AC_SUBST(PYTHON_SO)
+
 AM_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found]))
 if test "x$os_win32" = "xyes"; then
   AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be explicitly linked to libpython.]))
index c41f5f58a466105910c7231a309587160566eb7f..50450bc7976dde5fcb6db251eb80c578e16228b9 100644 (file)
@@ -177,6 +177,7 @@ PYTHON_LIBS = @PYTHON_LIBS@
 PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
index 4d931337acd5eb340b6c1e94942ef8d75cc03ad3..c687d316c636ca1fcd5397a16dc94caeb2ba2074 100644 (file)
@@ -10,7 +10,8 @@ extension_cppflags = \
 
 extension_ldflags = \
        -module \
-       -avoid-version
+       -avoid-version \
+       -shrext $(PYTHON_SO)
 
 if OS_WIN32
 # Windows requires Python modules to be explicitly linked to libpython.
@@ -20,8 +21,7 @@ extension_libadd = \
        $(PYTHON_LIBS)
 
 extension_ldflags += \
-       -no-undefined \
-       -shrext ".pyd"
+       -no-undefined
 endif
 
 pygidir = $(pyexecdir)/gi
@@ -114,7 +114,7 @@ _gi_cairo_la_LDFLAGS = \
 # This is to ensure we have a symlink to the .so in the
 # build directory, which the Python interpreter can load
 # directly without having to know how to parse .la files.
-.la.so:
+%$(PYTHON_SO): %.la
        $(LN_S) -f .libs/$@ $@
 
 # if we build in a separate tree, we need to symlink the *.py files from the
@@ -125,8 +125,8 @@ build_pylinks:
            [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
        done
 
-all-local: $(LTLIBRARIES:.la=.so) build_pylinks
+all-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
 
-check-local: $(LTLIBRARIES:.la=.so) build_pylinks
+check-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
 clean-local:
-       rm -f $(LTLIBRARIES:.la=.so)
+       rm -f $(LTLIBRARIES:.la=$(PYTHON_SO))
index 7d17d1be16dd3a1d850d92741062a3d0506f8743..dd02a4c7c868e57f14e35a02a33c69f4af376cb3 100644 (file)
@@ -52,8 +52,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 @OS_WIN32_TRUE@am__append_1 = \
-@OS_WIN32_TRUE@        -no-undefined \
-@OS_WIN32_TRUE@        -shrext ".pyd"
+@OS_WIN32_TRUE@        -no-undefined
 
 @ENABLE_CAIRO_TRUE@am__append_2 = _gi_cairo.la
 subdir = gi
@@ -303,6 +302,7 @@ PYTHON_LIBS = @PYTHON_LIBS@
 PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
@@ -378,7 +378,8 @@ extension_cppflags = \
        $(PYTHON_INCLUDES) \
        -DPY_SSIZE_T_CLEAN
 
-extension_ldflags = -module -avoid-version $(am__append_1)
+extension_ldflags = -module -avoid-version -shrext $(PYTHON_SO) \
+       $(am__append_1)
 
 # Windows requires Python modules to be explicitly linked to libpython.
 # Extension modules are shared libaries (.dll), but need to be
@@ -477,7 +478,7 @@ _gi_cairo_la_LDFLAGS = \
 all: all-recursive
 
 .SUFFIXES:
-.SUFFIXES: .c .la .lo .o .obj .so
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
@@ -1097,7 +1098,7 @@ uninstall-am: uninstall-pygiLTLIBRARIES uninstall-pygiPYTHON
 # This is to ensure we have a symlink to the .so in the
 # build directory, which the Python interpreter can load
 # directly without having to know how to parse .la files.
-.la.so:
+%$(PYTHON_SO): %.la
        $(LN_S) -f .libs/$@ $@
 
 # if we build in a separate tree, we need to symlink the *.py files from the
@@ -1108,11 +1109,11 @@ build_pylinks:
            [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
        done
 
-all-local: $(LTLIBRARIES:.la=.so) build_pylinks
+all-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
 
-check-local: $(LTLIBRARIES:.la=.so) build_pylinks
+check-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
 clean-local:
-       rm -f $(LTLIBRARIES:.la=.so)
+       rm -f $(LTLIBRARIES:.la=$(PYTHON_SO))
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
index 4feb06b31593df8f8b70906841a374f89580d562..774b7e115e3105ca7e0f74e5fda2677c8bb9f78d 100644 (file)
@@ -6,7 +6,8 @@ extension_cppflags = \
 
 extension_ldflags = \
        -module \
-       -avoid-version
+       -avoid-version \
+       -shrext $(PYTHON_SO)
 
 if OS_WIN32
 # Windows requires Python modules to be explicitly linked to libpython.
@@ -16,8 +17,7 @@ extension_libadd = \
        $(PYTHON_LIBS)
 
 extension_ldflags += \
-       -no-undefined \
-       -shrext ".pyd"
+       -no-undefined
 endif
 
 
@@ -56,8 +56,6 @@ _glib_la_SOURCES = \
        pygoptioncontext.h \
        pygoptiongroup.c \
        pygoptiongroup.h \
-       pygsource.c \
-       pygsource.h \
        pygspawn.c \
        pygspawn.h
 _glib_la_CFLAGS = \
@@ -85,9 +83,9 @@ build_pylinks:
        done
 
 
-all: $(pyglib_LTLIBRARIES:.la=.so) build_pylinks
-check-local: $(pyglib_LTLIBRARIES:.la=.so) build_pylinks
+all: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
+check-local: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
 clean-local:
-       rm -f $(pyglib_LTLIBRARIES:.la=.so)
-.la.so:
+       rm -f $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO))
+%$(PYTHON_SO): %.la
        $(LN_S) -f .libs/$@ $@
index 5a05798d316040238d55e17fc4af6eeef0ba10ae..282937659d720a13b5baf62be1de0959c733881f 100644 (file)
@@ -52,8 +52,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 @OS_WIN32_TRUE@am__append_1 = \
-@OS_WIN32_TRUE@        -no-undefined \
-@OS_WIN32_TRUE@        -shrext ".pyd"
+@OS_WIN32_TRUE@        -no-undefined
 
 @PLATFORM_WIN32_TRUE@am__append_2 = -DPLATFORM_WIN32
 subdir = gi/_glib
@@ -107,7 +106,7 @@ _glib_la_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
        libpyglib-gi-2.0-@PYTHON_BASENAME@.la
 am__glib_la_OBJECTS = _glib_la-glibmodule.lo \
        _glib_la-pygoptioncontext.lo _glib_la-pygoptiongroup.lo \
-       _glib_la-pygsource.lo _glib_la-pygspawn.lo
+       _glib_la-pygspawn.lo
 _glib_la_OBJECTS = $(am__glib_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -266,6 +265,7 @@ PYTHON_LIBS = @PYTHON_LIBS@
 PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
@@ -336,7 +336,8 @@ extension_cppflags = \
        $(PYTHON_INCLUDES) \
        -DPY_SSIZE_T_CLEAN
 
-extension_ldflags = -module -avoid-version $(am__append_1)
+extension_ldflags = -module -avoid-version -shrext $(PYTHON_SO) \
+       $(am__append_1)
 
 # Windows requires Python modules to be explicitly linked to libpython.
 # Extension modules are shared libaries (.dll), but need to be
@@ -377,8 +378,6 @@ _glib_la_SOURCES = \
        pygoptioncontext.h \
        pygoptiongroup.c \
        pygoptiongroup.h \
-       pygsource.c \
-       pygsource.h \
        pygspawn.c \
        pygspawn.h
 
@@ -398,7 +397,7 @@ _glib_la_LDFLAGS = \
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .la .lo .o .obj .so
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
@@ -507,7 +506,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-glibmodule.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygoptioncontext.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygoptiongroup.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygsource.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_glib_la-pygspawn.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpyglib_gi_2_0_@PYTHON_BASENAME@_la-pyglib.Plo@am__quote@
 
@@ -553,13 +551,6 @@ _glib_la-pygoptiongroup.lo: pygoptiongroup.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-pygoptiongroup.lo `test -f 'pygoptiongroup.c' || echo '$(srcdir)/'`pygoptiongroup.c
 
-_glib_la-pygsource.lo: pygsource.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -MT _glib_la-pygsource.lo -MD -MP -MF $(DEPDIR)/_glib_la-pygsource.Tpo -c -o _glib_la-pygsource.lo `test -f 'pygsource.c' || echo '$(srcdir)/'`pygsource.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/_glib_la-pygsource.Tpo $(DEPDIR)/_glib_la-pygsource.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='pygsource.c' object='_glib_la-pygsource.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -c -o _glib_la-pygsource.lo `test -f 'pygsource.c' || echo '$(srcdir)/'`pygsource.c
-
 _glib_la-pygspawn.lo: pygspawn.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_glib_la_CPPFLAGS) $(CPPFLAGS) $(_glib_la_CFLAGS) $(CFLAGS) -MT _glib_la-pygspawn.lo -MD -MP -MF $(DEPDIR)/_glib_la-pygspawn.Tpo -c -o _glib_la-pygspawn.lo `test -f 'pygspawn.c' || echo '$(srcdir)/'`pygspawn.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/_glib_la-pygspawn.Tpo $(DEPDIR)/_glib_la-pygspawn.Plo
@@ -842,11 +833,11 @@ build_pylinks:
            [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
        done
 
-all: $(pyglib_LTLIBRARIES:.la=.so) build_pylinks
-check-local: $(pyglib_LTLIBRARIES:.la=.so) build_pylinks
+all: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
+check-local: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
 clean-local:
-       rm -f $(pyglib_LTLIBRARIES:.la=.so)
-.la.so:
+       rm -f $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO))
+%$(PYTHON_SO): %.la
        $(LN_S) -f .libs/$@ $@
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
index 11aee9de71f5f6ba1b21289604cbd56f291742d2..d08d4fbafe5f8e13e4e7125b28b3f33ef832439d 100644 (file)
 #include "pyglib-private.h"
 #include "pygoptioncontext.h"
 #include "pygoptiongroup.h"
-#include "pygsource.h"
 #include "pygspawn.h"
 
 /* ---------------- glib module functions -------------------- */
 
-static PyObject *
-pyglib_threads_init(PyObject *unused, PyObject *args, PyObject *kwargs)
-{
-    if (!pyglib_enable_threads())
-        return NULL;
-
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-
 static PyMethodDef _glib_functions[] = {
-    { "threads_init",
-      (PyCFunction) pyglib_threads_init, METH_NOARGS,
-      "threads_init()\n"
-      "Initialize GLib for use from multiple threads. If you also use GTK+\n"
-      "itself (i.e. GUI, not just PyGObject), use gtk.gdk.threads_init()\n"
-      "instead." },
     { "spawn_async",
       (PyCFunction)pyglib_spawn_async, METH_VARARGS|METH_KEYWORDS,
       "spawn_async(argv, envp=None, working_directory=None,\n"
@@ -113,7 +96,6 @@ PYGLIB_MODULE_START(_glib, "_glib")
 
     pyglib_register_api(d);
     pyglib_register_error(d);
-    pyglib_source_register_types(d);
     pyglib_spawn_register_types(d);
     pyglib_option_context_register_types(d);
     pyglib_option_group_register_types(d);
index 9ba68f7bb97353a286fb4140dc676491d398e807..96c27ca0e6993dab02f818173a4ffc184ea243a1 100644 (file)
 #ifndef __PYGLIB_PYTHON_COMPAT_H__
 #define __PYGLIB_PYTHON_COMPAT_H__
 
-/* Python 2.3 does not define Py_CLEAR */
-#ifndef Py_CLEAR
-#define Py_CLEAR(op)                \
-        do {                                \
-                if (op) {           \
-                        PyObject *tmp = (PyObject *)(op);   \
-                        (op) = NULL;        \
-                        Py_DECREF(tmp);     \
-                }               \
-        } while (0)
-#endif
-
-/* PyCObject superceded by PyCapsule on Python >= 2.7
- * However since this effects header files used by
- * static bindings we are only applying the change to
- * Python 3.x where we don't support the static bindings.
- * 3.2 removed PyCObject so we don't have any choice here.
- *
- * There is talk upstream of undeprecating PyCObject
- * (at least where the 2.x branch is concerned)
- * and there is no danger of it being remove from 2.7.
- **/
-#if PY_VERSION_HEX >= 0x03000000
 # define PYGLIB_CPointer_Check PyCapsule_CheckExact
 # define PYGLIB_CPointer_WrapPointer(ptr, typename) \
     PyCapsule_New(ptr, typename, NULL)
     PyCapsule_GetPointer(obj, typename)
 # define PYGLIB_CPointer_Import(module, symbol) \
     PyCapsule_Import(##module##.##symbol##, FALSE)
-#else
-# define PYGLIB_CPointer_Check PyCObject_Check
-# define PYGLIB_CPointer_WrapPointer(ptr, typename) \
-    PyCObject_FromVoidPtr(ptr, NULL)
-# define PYGLIB_CPointer_GetPointer(obj, typename) \
-  PyCObject_AsVoidPtr(obj)
-# define PYGLIB_CPointer_Import(module, symbol) \
-    PyCObject_Import(module, symbol)
-#endif
 
 #if PY_VERSION_HEX < 0x03000000
 
index ef8a02e34ba7877005635c72298514808512f161..54b2d90afd5eb3f2c018c804737feaa7d8c74878 100644 (file)
@@ -31,7 +31,6 @@
 #include "pygoptiongroup.h"
 
 static struct _PyGLib_Functions *_PyGLib_API;
-static int pyglib_thread_state_tls_key;
 static PyObject *exception_table = NULL;
 
 void
@@ -77,99 +76,6 @@ pyglib_init_internal(PyObject *api)
     _PyGLib_API = (struct _PyGLib_Functions *) PYGLIB_CPointer_GetPointer(api, "gi._glib._PyGLib_API");
 }
 
-gboolean
-pyglib_threads_enabled(void)
-{
-    g_return_val_if_fail (_PyGLib_API != NULL, FALSE);
-
-    return _PyGLib_API->threads_enabled;
-}
-
-PyGILState_STATE
-pyglib_gil_state_ensure(void)
-{
-    g_return_val_if_fail (_PyGLib_API != NULL, PyGILState_LOCKED);
-
-    if (!_PyGLib_API->threads_enabled)
-       return PyGILState_LOCKED;
-
-#ifdef DISABLE_THREADING
-    return PyGILState_LOCKED;
-#else
-    return PyGILState_Ensure();
-#endif
-}
-
-void
-pyglib_gil_state_release(PyGILState_STATE state)
-{
-    g_return_if_fail (_PyGLib_API != NULL);
-
-    if (!_PyGLib_API->threads_enabled)
-       return;
-
-#ifndef DISABLE_THREADING
-    PyGILState_Release(state);
-#endif
-}
-
-/**
- * pyglib_enable_threads:
- *
- * Returns: TRUE if threading is enabled, FALSE otherwise.
- *
- */
-#ifdef DISABLE_THREADING
-gboolean
-pyglib_enable_threads(void)
-{
-    PyErr_SetString(PyExc_RuntimeError,
-                   "pyglib threading disabled at compile time");
-    return FALSE;
-}
-
-void
-_pyglib_notify_on_enabling_threads(PyGLibThreadsEnabledFunc callback)
-{
-    /* Ignore, threads cannot be enabled. */
-}
-
-#else
-
-static GSList *thread_enabling_callbacks = NULL;
-
-/* Enable threading; note that the GIL must be held by the current
- * thread when this function is called
- */
-gboolean
-pyglib_enable_threads(void)
-{
-    GSList *callback;
-
-    g_return_val_if_fail (_PyGLib_API != NULL, FALSE);
-
-    if (_PyGLib_API->threads_enabled)
-       return TRUE;
-  
-    PyEval_InitThreads();
-    _PyGLib_API->threads_enabled = TRUE;
-    pyglib_thread_state_tls_key = PyThread_create_key();
-
-    for (callback = thread_enabling_callbacks; callback; callback = callback->next)
-       ((PyGLibThreadsEnabledFunc) callback->data) ();
-
-    g_slist_free(thread_enabling_callbacks);
-    return TRUE;
-}
-
-void
-_pyglib_notify_on_enabling_threads(PyGLibThreadsEnabledFunc callback)
-{
-    if (callback && !pyglib_threads_enabled())
-       thread_enabling_callbacks = g_slist_append(thread_enabling_callbacks, callback);
-}
-#endif
-
 /**
  * pyglib_block_threads:
  *
index bc80d6d73f646613b8552a7813975bcc51d21f43..0b587b83c92def44f0dfed408752bd32efebc5ff 100644 (file)
@@ -33,15 +33,24 @@ typedef void (*PyGLibThreadBlockFunc) (void);
 
 void pyglib_init(void);
 void pyglib_init_internal(PyObject *api);
-PyGILState_STATE pyglib_gil_state_ensure(void);
-void pyglib_gil_state_release(PyGILState_STATE state);
-int pyglib_enable_threads(void);
+
+#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
+
 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);
-gboolean pyglib_threads_enabled(void);
 void pyglib_set_thread_block_funcs(PyGLibThreadBlockFunc block_threads_func,
                                   PyGLibThreadBlockFunc unblock_threads_func);
 void pyglib_block_threads(void);
@@ -51,20 +60,9 @@ PyObject * pyglib_option_group_new(GOptionGroup *group);
 GOptionGroup * pyglib_option_group_transfer_group(PyObject *self);
 
 /* Private: for gobject <-> glib interaction only. */
-void _pyglib_notify_on_enabling_threads(PyGLibThreadsEnabledFunc callback);
 PyObject* _pyglib_generic_ptr_richcompare(void* a, void *b, int op);
 PyObject* _pyglib_generic_long_richcompare(long a, long b, int op);
 
-#define pyglib_begin_allow_threads             \
-    G_STMT_START {                              \
-        PyThreadState *_save = NULL;            \
-        if (pyglib_threads_enabled())          \
-            _save = PyEval_SaveThread();
-
-#define pyglib_end_allow_threads                \
-        if (pyglib_threads_enabled())           \
-            PyEval_RestoreThread(_save);        \
-    } G_STMT_END
 
 #define PYGLIB_REGISTER_TYPE(d, type, name)            \
     if (!type.tp_alloc)                                 \
diff --git a/gi/_glib/pygsource.c b/gi/_glib/pygsource.c
deleted file mode 100644 (file)
index 5a333c4..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4 -*-
- * pygtk- Python bindings for the GTK toolkit.
- * Copyright (C) 1998-2003  James Henstridge
- * Copyright (C) 2005       Oracle
- *
- * Author: Manish Singh <manish.singh@oracle.com>
- *
- *   pygsource.c: GSource wrapper
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
-#include <Python.h>
-#include <structmember.h> /* for PyMemberDef */
-#include "pyglib.h"
-#include "pyglib-private.h"
-#include "pygsource.h"
-
-/* glib.PollFD */
-
-PYGLIB_DEFINE_TYPE("gi._glib.PollFD", PyGPollFD_Type, PyGPollFD)
-
-static PyMemberDef pyg_poll_fd_members[] = {
-    { "fd",      T_INT,    offsetof(PyGPollFD, pollfd.fd),      READONLY },
-    { "events",  T_USHORT, offsetof(PyGPollFD, pollfd.events),  READONLY },
-    { "revents", T_USHORT, offsetof(PyGPollFD, pollfd.revents), READONLY },
-    { NULL, 0, 0, 0 }
-};
-
-static void
-pyg_poll_fd_dealloc(PyGPollFD *self)
-{
-    Py_XDECREF(self->fd_obj);
-    PyObject_DEL(self);
-}
-
-static PyObject *
-pyg_poll_fd_repr(PyGPollFD *self)
-{
-    return PYGLIB_PyUnicode_FromFormat("<GPollFD %d (%d) at 0x%lx>",
-                                self->pollfd.fd, self->pollfd.events,
-                                (long)self);
-}
-
-static int
-pyg_poll_fd_init(PyGPollFD *self, PyObject *args, PyObject *kwargs)
-{
-    static char *kwlist[] = { "fd", "events", NULL };
-    PyObject *o;
-    gint fd;
-    gushort events;
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-                                    "OH:gi._glib.PollFD.__init__", kwlist,
-                                    &o, &events))
-       return -1;
-
-    fd = PyObject_AsFileDescriptor(o);
-    if (fd == -1)
-       return -1;
-
-    self->pollfd.fd = fd;
-    self->pollfd.events = events;
-    self->pollfd.revents = 0;
-
-    Py_INCREF(o);
-    self->fd_obj = o;
-
-    return 0;
-}
-
-void
-pyglib_source_register_types(PyObject *d)
-{
-    PyGPollFD_Type.tp_dealloc = (destructor)pyg_poll_fd_dealloc;
-    PyGPollFD_Type.tp_repr = (reprfunc)pyg_poll_fd_repr;
-    PyGPollFD_Type.tp_flags = Py_TPFLAGS_DEFAULT;
-    PyGPollFD_Type.tp_members = pyg_poll_fd_members;
-    PyGPollFD_Type.tp_init = (initproc)pyg_poll_fd_init;
-    PYGLIB_REGISTER_TYPE(d, PyGPollFD_Type, "PollFD");
-}
diff --git a/gi/_glib/pygsource.h b/gi/_glib/pygsource.h
deleted file mode 100644 (file)
index dbae9ac..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4 -*-
- * pyglib - Python bindings for GLib toolkit.
- * Copyright (C) 1998-2003  James Henstridge
- *               2004-2008  Johan Dahlin
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- */
-
-#ifndef __PYG_SOURCE_H__
-#define __PYG_SOURCE_H__
-
-extern PyTypeObject PyGPollFD_Type;
-
-typedef struct
-{
-    PyObject_HEAD
-    GPollFD pollfd;
-    PyObject *fd_obj;
-} PyGPollFD;
-
-void pyglib_source_register_types(PyObject *d);
-
-#endif /* __PYG_SOURCE_H__ */
index d8613a96e4a91833bdf349aacbf3ed366d09f9b0..5059ea757935424268d4ee3ef2f55ff7ffc5a850 100644 (file)
@@ -10,7 +10,8 @@ extension_cppflags = \
 
 extension_ldflags = \
        -module \
-       -avoid-version
+       -avoid-version \
+       -shrext $(PYTHON_SO)
 
 if OS_WIN32
 # Windows requires Python modules to be explicitly linked to libpython.
@@ -20,8 +21,7 @@ extension_libadd = \
        $(PYTHON_LIBS)
 
 extension_ldflags += \
-       -no-undefined \
-       -shrext ".pyd"
+       -no-undefined
 endif
 
 pygobjectdir = $(pyexecdir)/gi/_gobject
@@ -79,9 +79,9 @@ build_pylinks:
        done
 
 
-all: $(pygobject_LTLIBRARIES:.la=.so) build_pylinks
-check-local: $(pygobject_LTLIBRARIES:.la=.so) build_pylinks
+all: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
+check-local: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
 clean-local:
-       rm -f $(pygobject_LTLIBRARIES:.la=.so)
-.la.so:
+       rm -f $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO))
+%$(PYTHON_SO): %.la
        $(LN_S) -f .libs/$@ $@
index 402a145d4eb98622d21f0441601ac5b421eba186..ce28f0e14ac2d6d78762827906f125bfb7f36d02 100644 (file)
@@ -52,8 +52,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 @OS_WIN32_TRUE@am__append_1 = \
-@OS_WIN32_TRUE@        -no-undefined \
-@OS_WIN32_TRUE@        -shrext ".pyd"
+@OS_WIN32_TRUE@        -no-undefined
 
 subdir = gi/_gobject
 DIST_COMMON = $(pkginclude_HEADERS) $(pygobject_PYTHON) \
@@ -256,6 +255,7 @@ PYTHON_LIBS = @PYTHON_LIBS@
 PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
@@ -328,7 +328,8 @@ extension_cppflags = \
        $(PYTHON_INCLUDES) \
        -DPY_SSIZE_T_CLEAN
 
-extension_ldflags = -module -avoid-version $(am__append_1)
+extension_ldflags = -module -avoid-version -shrext $(PYTHON_SO) \
+       $(am__append_1)
 
 # Windows requires Python modules to be explicitly linked to libpython.
 # Extension modules are shared libaries (.dll), but need to be
@@ -387,7 +388,7 @@ _gobject_la_LDFLAGS = \
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .la .lo .o .obj .so
+.SUFFIXES: .c .lo .o .obj
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
@@ -843,11 +844,11 @@ build_pylinks:
            [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
        done
 
-all: $(pygobject_LTLIBRARIES:.la=.so) build_pylinks
-check-local: $(pygobject_LTLIBRARIES:.la=.so) build_pylinks
+all: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
+check-local: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
 clean-local:
-       rm -f $(pygobject_LTLIBRARIES:.la=.so)
-.la.so:
+       rm -f $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO))
+%$(PYTHON_SO): %.la
        $(LN_S) -f .libs/$@ $@
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
index 359c2c715bef23db55016195089b38bc1af9752c..3de839d43b66647d118f76857b059d0ca41091b8 100644 (file)
@@ -128,7 +128,7 @@ pyg_type_from_name (PyObject *self, PyObject *args)
 #endif
     if (!PyArg_ParseTuple(args, "s:gobject.type_from_name", &name))
        return NULL;
-    type = _pyg_type_from_name(name);
+    type = g_type_from_name(name);
     if (type != 0)
        return pyg_type_wrapper_new(type);
     repr = PyObject_Repr((PyObject*)self);
@@ -958,7 +958,7 @@ get_type_name_for_class(PyTypeObject *class)
        for (i = 0; type_name[i] != '\0'; i++)
            if (type_name[i] == '.')
                type_name[i] = '+';
-       if (_pyg_type_from_name(type_name) == 0)
+       if (g_type_from_name(type_name) == 0)
            break;              /* we now have a unique name */
        ++name_serial;
     }
@@ -1180,6 +1180,10 @@ pyg_type_register(PyTypeObject *class, const char *type_name)
     g_type_set_qdata(instance_type, g_quark_from_string("PyGObject::class"),
                     class);
 
+    /* Mark this GType as a custom python type */
+    g_type_set_qdata(instance_type, pygobject_custom_key,
+                     GINT_TO_POINTER (1));
+
     /* set new value of __gtype__ on class */
     gtype = pyg_type_wrapper_new(instance_type);
     PyObject_SetAttrString((PyObject *)class, "__gtype__", gtype);
@@ -1525,31 +1529,13 @@ pygobject_gil_state_release (int flag)
     pyglib_gil_state_release(flag);
 }
 
-static PyObject *
-pyg_threads_init (PyObject *unused, PyObject *args, PyObject *kwargs)
-{
-    if (!pyglib_enable_threads())
-        return NULL;
-
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-
 /* Only for backwards compatibility */
 static int
 pygobject_enable_threads(void)
 {
-    if (!pyglib_enable_threads())
-       return -1;
     return 0;
 }
 
-static void
-pyg_note_threads_enabled(void)
-{
-    pygobject_api_functions.threads_enabled = TRUE;
-}
-
 static PyObject *
 pyg_signal_accumulator_true_handled(PyObject *unused, PyObject *args)
 {
@@ -1690,8 +1676,6 @@ static PyMethodDef _gobject_functions[] = {
       pyg_object_class_list_properties, METH_VARARGS },
     { "new",
       (PyCFunction)pyg_object_new, METH_VARARGS|METH_KEYWORDS },
-    { "threads_init",
-      (PyCFunction)pyg_threads_init, METH_VARARGS|METH_KEYWORDS },
     { "signal_accumulator_true_handled",
       (PyCFunction)pyg_signal_accumulator_true_handled, METH_VARARGS },
     { "add_emission_hook",
@@ -2068,7 +2052,13 @@ struct _PyGObject_Functions pygobject_api_functions = {
   pyg_flags_add,
   pyg_flags_from_gtype,
 
-  FALSE, /* threads_enabled */
+  /* threads_enabled */
+#ifdef DISABLE_THREADING
+  FALSE,
+#else
+  TRUE,
+#endif
+
   pygobject_enable_threads,
   pygobject_gil_state_ensure,
   pygobject_gil_state_release,
@@ -2080,7 +2070,8 @@ struct _PyGObject_Functions pygobject_api_functions = {
   add_warning_redirection,
   disable_warning_redirections,
 
-  pyg_type_register_custom_callback,
+  NULL, /* previously type_register_custom */
+
   pyg_gerror_exception_check,
 
   pyglib_option_group_new,
@@ -2175,9 +2166,6 @@ PYGLIB_MODULE_START(_gobject, "_gobject")
 {
     PyObject *d;
 
-#if !defined(GLIB_VERSION_2_36)
-    g_type_init();
-#endif
     pyglib_init();
 
     d = PyModule_GetDict(module);
@@ -2194,8 +2182,5 @@ PYGLIB_MODULE_START(_gobject, "_gobject")
     pygobject_pointer_register_types(d);
     pygobject_enum_register_types(d);
     pygobject_flags_register_types(d);
-
-    pygobject_api_functions.threads_enabled = pyglib_threads_enabled();
-    _pyglib_notify_on_enabling_threads(pyg_note_threads_enabled);
 }
 PYGLIB_MODULE_END
index 83aa4dcd26a2d460e46151aa3536781c8e3a1edc..bdeaae745a7b8b00ac8f80c8a08bb21a5726977d 100644 (file)
@@ -129,12 +129,12 @@ static PyObject *
 pyg_flags_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 {
     static char *kwlist[] = { "value", NULL };
-    guint value;
+    gulong value;
     PyObject *pytc, *values, *ret, *pyint;
     GType gtype;
     GFlagsClass *eclass;
 
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "l", kwlist, &value))
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k", kwlist, &value))
        return NULL;
 
     pytc = PyObject_GetAttrString((PyObject *)type, "__gtype__");
index e1fc2b61a67c4dc9bf57c087e80913cc4611f9a1..5de7488d98564862f4160b0902db8bfb9f74d148 100644 (file)
@@ -81,6 +81,7 @@ extern GQuark pygobject_wrapper_key;
 extern GQuark pygpointer_class_key;
 extern GQuark pygobject_has_updated_constructor_key;
 extern GQuark pygobject_instance_data_key;
+extern GQuark pygobject_custom_key;
 
 void     pygobject_data_free  (PyGObjectData *data);
 void     pyg_destroy_notify   (gpointer     user_data);
@@ -214,12 +215,7 @@ extern PyObject * pyg_enum_from_gtype (GType        gtype,
                                       int          value);
 
 /* pygtype.c */
-extern GHashTable *custom_type_registration;
-void pyg_type_register_custom_callback(const gchar *type_name,
-                                      PyGTypeRegistrationFunction callback,
-                                      gpointer data);
-PyTypeObject * pyg_type_get_custom(const gchar *name);
-GType _pyg_type_from_name(const gchar *name);
+extern gboolean pyg_gtype_is_custom (GType gtype);
 
 /* pygobject.c */
 extern PyTypeObject PyGObjectWeakRef_Type;
index 93b42ee441cd4df9d1809b7e0284d5a8ac0a2525..4ca360a5e776ab304f3392ad397563b9421cf6a6 100644 (file)
@@ -45,6 +45,7 @@ static void pygobject_inherit_slots(PyTypeObject *type, PyObject *bases,
 static void pygobject_find_slot_for(PyTypeObject *type, PyObject *bases, int slot_offset,
                                    gboolean check_for_present);
 GType PY_TYPE_OBJECT = 0;
+GQuark pygobject_custom_key;
 GQuark pygobject_class_key;
 GQuark pygobject_class_init_key;
 GQuark pygobject_wrapper_key;
@@ -149,8 +150,6 @@ pygobject_get_inst_data(PyGObject *self)
 }
 
 
-GHashTable *custom_type_registration = NULL;
-
 PyTypeObject *PyGObject_MetaType = NULL;
 
 /**
@@ -300,15 +299,16 @@ PyGProps_getattro(PyGProps *self, PyObject *attr)
         return pyg_param_spec_new(pspec);
     }
 
-    /* See if the property's class is from the gi repository. If so,
-     * use gi to correctly read the property value. */
-    ret = pygi_get_property_value (self->pygobject, pspec);
-    if (ret != NULL) {
-        return ret;
+    if (!pyg_gtype_is_custom (pspec->owner_type)) {
+        /* The GType is not implemented at the Python level: see if we can
+         * read the property value via gi. */
+        ret = pygi_get_property_value (self->pygobject, pspec);
+        if (ret)
+            return ret;
     }
-    
-    /* If we reach here, it must be a property defined outside of gi.
-     * Just do a straightforward read. */
+
+    /* The GType is implemented in Python, or we failed to read it via gi:
+     * do a straightforward read. */
     g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE(pspec));
     pyg_begin_allow_threads;
     g_object_get_property(self->pygobject->obj, pspec->name, &value);
@@ -403,18 +403,18 @@ PyGProps_setattro(PyGProps *self, PyObject *attr, PyObject *pvalue)
     if (!pspec) {
        return PyObject_GenericSetAttr((PyObject *)self, attr, pvalue);
     }
-
-    /* See if the property's class is from the gi repository. If so,
-     * use gi to correctly read the property value. */
-    ret = pygi_set_property_value (self->pygobject, pspec, pvalue);
-    if (ret == 0)
-        return 0;
-    else if (ret == -1)
-        if (PyErr_Occurred())
+    if (!pyg_gtype_is_custom (pspec->owner_type)) {
+        /* This GType is not implemented in Python: see if we can set the
+         * property via gi. */
+        ret = pygi_set_property_value (self->pygobject, pspec, pvalue);
+        if (ret == 0)
+            return 0;
+        else if (ret == -1 && PyErr_Occurred())
             return -1;
+    }
 
-    /* If we reach here, it must be a property defined outside of gi.
-     * Just do a straightforward set. */
+    /* This GType is implemented in Python, or we failed to set it via gi:
+     * do a straightforward set. */
     if (!set_property_from_pspec(obj, pspec, pvalue))
        return -1;
                                  
@@ -934,10 +934,6 @@ pygobject_lookup_class(GType gtype)
     if (gtype == G_TYPE_INTERFACE)
        return &PyGInterface_Type;
     
-    py_type = pyg_type_get_custom(g_type_name(gtype));
-    if (py_type)
-       return py_type;
-
     py_type = g_type_get_qdata(gtype, pygobject_class_key);
     if (py_type == NULL) {
        py_type = g_type_get_qdata(gtype, pyginterface_type_key);
@@ -1638,15 +1634,52 @@ pygobject_bind_property(PyGObject *self, PyObject *args)
        return pygbinding_weak_ref_new(G_OBJECT (binding));
 }
 
+static PyObject *
+connect_helper(PyGObject *self, gchar *name, PyObject *callback, PyObject *extra_args, PyObject *object, gboolean after)
+{
+    guint sigid;
+    GQuark detail = 0;
+    GClosure *closure = NULL;
+    gulong handlerid;
+    GSignalQuery query_info;
+
+    if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj),
+                            &sigid, &detail, TRUE)) {
+       PyObject *repr = PyObject_Repr((PyObject*)self);
+       PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
+                    PYGLIB_PyUnicode_AsString(repr),
+                    name);
+       Py_DECREF(repr);
+       return NULL;
+    }
+
+    g_signal_query (sigid, &query_info);
+    if (!pyg_gtype_is_custom (query_info.itype)) {
+        /* The signal is implemented by a non-Python class, probably
+         * something in the gi repository. */
+        closure = pygi_signal_closure_new (self, query_info.itype,
+                                           query_info.signal_name, callback,
+                                           extra_args, object);
+    }
+
+    if (!closure) {
+        /* The signal is either implemented at the Python level, or it comes
+         * from a foreign class that we don't have introspection data for. */
+        closure = pyg_closure_new (callback, extra_args, object);
+    }
+
+    pygobject_watch_closure((PyObject *)self, closure);
+    handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail,
+                                              closure, after);
+    return PyLong_FromUnsignedLong(handlerid);
+}
+
 static PyObject *
 pygobject_connect(PyGObject *self, PyObject *args)
 {
-    PyObject *first, *callback, *extra_args, *repr = NULL;
+    PyObject *first, *callback, *extra_args, *ret;
     gchar *name;
-    guint sigid, len;
-    gulong handlerid;
-    GQuark detail = 0;
-    GClosure *closure;
+    guint len;
 
     len = PyTuple_Size(args);
     if (len < 2) {
@@ -1667,40 +1700,21 @@ pygobject_connect(PyGObject *self, PyObject *args)
     
     CHECK_GOBJECT(self);
     
-    if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj),
-                            &sigid, &detail, TRUE)) {
-       repr = PyObject_Repr((PyObject*)self);
-       PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
-                    PYGLIB_PyUnicode_AsString(repr),
-                    name);
-       Py_DECREF(repr);
-       return NULL;
-    }
     extra_args = PySequence_GetSlice(args, 2, len);
     if (extra_args == NULL)
        return NULL;
 
-    closure = pygi_signal_closure_new(self, name, callback, extra_args, NULL);
-    if (closure == NULL)
-        closure = pyg_closure_new(callback, extra_args, NULL);
-
-    pygobject_watch_closure((PyObject *)self, closure);
-    handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail,
-                                              closure, FALSE);
+    ret = connect_helper(self, name, callback, extra_args, NULL, FALSE);
     Py_DECREF(extra_args);
-    return PyLong_FromUnsignedLong(handlerid);
+    return ret;
 }
 
 static PyObject *
 pygobject_connect_after(PyGObject *self, PyObject *args)
 {
-    PyObject *first, *callback, *extra_args, *repr = NULL;
+    PyObject *first, *callback, *extra_args, *ret;
     gchar *name;
-    guint sigid;
-    gulong handlerid;
     Py_ssize_t len;
-    GQuark detail;
-    GClosure *closure;
 
     len = PyTuple_Size(args);
     if (len < 2) {
@@ -1722,40 +1736,21 @@ pygobject_connect_after(PyGObject *self, PyObject *args)
     
     CHECK_GOBJECT(self);
     
-    if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj),
-                            &sigid, &detail, TRUE)) {
-       repr = PyObject_Repr((PyObject*)self);
-       PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
-                    PYGLIB_PyUnicode_AsString(repr),
-                    name);
-       Py_DECREF(repr);
-       return NULL;
-    }
     extra_args = PySequence_GetSlice(args, 2, len);
     if (extra_args == NULL)
        return NULL;
 
-    closure = pygi_signal_closure_new(self, name, callback, extra_args, NULL);
-    if (closure == NULL)
-        closure = pyg_closure_new(callback, extra_args, NULL);
-
-    pygobject_watch_closure((PyObject *)self, closure);
-    handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail,
-                                              closure, TRUE);
+    ret = connect_helper(self, name, callback, extra_args, NULL, TRUE);
     Py_DECREF(extra_args);
-    return PyLong_FromUnsignedLong(handlerid);
+    return ret;
 }
 
 static PyObject *
 pygobject_connect_object(PyGObject *self, PyObject *args)
 {
-    PyObject *first, *callback, *extra_args, *object, *repr = NULL;
+    PyObject *first, *callback, *extra_args, *object, *ret;
     gchar *name;
-    guint sigid;
-    gulong handlerid;
     Py_ssize_t len;
-    GQuark detail;
-    GClosure *closure;
 
     len = PyTuple_Size(args);
     if (len < 3) {
@@ -1777,40 +1772,21 @@ pygobject_connect_object(PyGObject *self, PyObject *args)
     
     CHECK_GOBJECT(self);
     
-    if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj),
-                            &sigid, &detail, TRUE)) {
-       repr = PyObject_Repr((PyObject*)self);
-       PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
-                    PYGLIB_PyUnicode_AsString(repr),
-                    name);
-       Py_DECREF(repr);
-       return NULL;
-    }
     extra_args = PySequence_GetSlice(args, 3, len);
     if (extra_args == NULL)
        return NULL;
 
-    closure = pygi_signal_closure_new(self, name, callback, extra_args, object);
-    if (closure == NULL)
-        closure = pyg_closure_new(callback, extra_args, object);
-
-    pygobject_watch_closure((PyObject *)self, closure);
-    handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail,
-                                              closure, FALSE);
+    ret = connect_helper(self, name, callback, extra_args, object, FALSE);
     Py_DECREF(extra_args);
-    return PyLong_FromUnsignedLong(handlerid);
+    return ret;
 }
 
 static PyObject *
 pygobject_connect_object_after(PyGObject *self, PyObject *args)
 {
-    PyObject *first, *callback, *extra_args, *object, *repr = NULL;
+    PyObject *first, *callback, *extra_args, *object, *ret;
     gchar *name;
-    guint sigid;
-    gulong handlerid;
     Py_ssize_t len;
-    GQuark detail;
-    GClosure *closure;
 
     len = PyTuple_Size(args);
     if (len < 3) {
@@ -1832,28 +1808,13 @@ pygobject_connect_object_after(PyGObject *self, PyObject *args)
     
     CHECK_GOBJECT(self);
     
-    if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj),
-                            &sigid, &detail, TRUE)) {
-       repr = PyObject_Repr((PyObject*)self);
-       PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
-                    PYGLIB_PyUnicode_AsString(repr),
-                    name);
-       Py_DECREF(repr);
-       return NULL;
-    }
     extra_args = PySequence_GetSlice(args, 3, len);
     if (extra_args == NULL)
        return NULL;
 
-    closure = pygi_signal_closure_new(self, name, callback, extra_args, object);
-    if (closure == NULL)
-        closure = pyg_closure_new(callback, extra_args, object);
-
-    pygobject_watch_closure((PyObject *)self, closure);
-    handlerid = g_signal_connect_closure_by_id(self->obj, sigid, detail,
-                                              closure, TRUE);
+    ret = connect_helper(self, name, callback, extra_args, object, TRUE);
     Py_DECREF(extra_args);
-    return PyLong_FromUnsignedLong(handlerid);
+    return ret;
 }
 
 static PyObject *
@@ -2447,6 +2408,7 @@ pygobject_object_register_types(PyObject *d)
 {
     PyObject *o, *descr;
 
+    pygobject_custom_key = g_quark_from_static_string("PyGObject::custom");
     pygobject_class_key = g_quark_from_static_string("PyGObject::class");
     pygobject_class_init_key = g_quark_from_static_string("PyGObject::class-init");
     pygobject_wrapper_key = g_quark_from_static_string("PyGObject::wrapper");
index 15b8807023aa52dde16c484b695332789d00123e..3c5e384a3068a449e0830e7eef706665c8a3f116 100644 (file)
@@ -183,9 +183,11 @@ struct _PyGObject_Functions {
     void      (*add_warning_redirection) (const char *domain,
                                           PyObject   *warning);
     void      (*disable_warning_redirections) (void);
-    void      (*type_register_custom)(const gchar *type_name,
-                                     PyGTypeRegistrationFunction callback,
-                                     gpointer data);
+
+    /* type_register_custom API now removed, but leave a pointer here to not
+     * break ABI. */
+    void      *_type_register_custom;
+
     gboolean  (*gerror_exception_check) (GError **error);
     PyObject* (*option_group_new) (GOptionGroup *group);
     GType (* type_from_object_strict) (PyObject *obj, gboolean strict);
@@ -252,7 +254,6 @@ struct _PyGObject_Functions *_PyGObject_API;
 #define pyg_register_interface_info (_PyGObject_API->register_interface_info)
 #define pyg_add_warning_redirection   (_PyGObject_API->add_warning_redirection)
 #define pyg_disable_warning_redirections (_PyGObject_API->disable_warning_redirections)
-#define pyg_type_register_custom_callback (_PyGObject_API->type_register_custom)
 #define pyg_gerror_exception_check (_PyGObject_API->gerror_exception_check)
 #define pyg_option_group_new       (_PyGObject_API->option_group_new)
 
@@ -342,14 +343,8 @@ pygobject_init(int req_major, int req_minor, int req_micro)
     }
 
     cobject = PyObject_GetAttrString(gobject, "_PyGObject_API");
-#if PY_VERSION_HEX >= 0x03000000
     if (cobject && PyCapsule_CheckExact(cobject))
         _PyGObject_API = (struct _PyGObject_Functions *) PyCapsule_GetPointer(cobject, "gobject._PyGObject_API");
-
-#else
-    if (cobject && PyCObject_Check(cobject))
-        _PyGObject_API = (struct _PyGObject_Functions *) PyCObject_AsVoidPtr(cobject);
-#endif
     else {
         PyErr_SetString(PyExc_ImportError,
                         "could not import gobject (could not find _PyGObject_API object)");
index 94014ff387061b735b59a86099ccc023af5394b6..498c35e54db3a04f54d8607034a77904d61e8341 100644 (file)
@@ -268,7 +268,7 @@ _wrap_g_type_from_name(PyGTypeWrapper *_, PyObject *args)
     if (!PyArg_ParseTuple(args, "s:GType.from_name", &type_name))
        return NULL;
 
-    type = _pyg_type_from_name(type_name);
+    type = g_type_from_name(type_name);
     if (type == 0) {
        PyErr_SetString(PyExc_RuntimeError, "unknown type name");
        return NULL;
@@ -401,7 +401,7 @@ pyg_type_from_object_strict(PyObject *obj, gboolean strict)
     if (PYGLIB_PyUnicode_Check(obj)) {
        gchar *name = PYGLIB_PyUnicode_AsString(obj);
 
-       type = _pyg_type_from_name(name);
+       type = g_type_from_name(name);
        if (type != 0) {
            return type;
        }
@@ -1820,69 +1820,10 @@ pyg_param_gvalue_as_pyobject(const GValue* gvalue,
     }
 }
 
-/**
- * pyg_type_registration_callback
- * @gtypename: type name
- * @callback: function to run
- *
- */
-typedef struct {
-    PyGTypeRegistrationFunction callback;
-    gpointer data;
-} CustomTypeData;
-
-void
-pyg_type_register_custom_callback(const gchar *typename,
-                                 PyGTypeRegistrationFunction callback,
-                                 gpointer user_data)
+gboolean
+pyg_gtype_is_custom(GType gtype)
 {
-    CustomTypeData *data;
-
-    if (!custom_type_registration)
-       custom_type_registration = g_hash_table_new_full (g_str_hash, g_str_equal,
-                                                         g_free, g_free);
-
-    data = g_new (CustomTypeData, 1);
-    data->callback = callback;
-    data->data = user_data;
-
-    g_hash_table_insert(custom_type_registration,
-                       g_strdup(typename),
-                       data);
-}
-
-PyTypeObject *
-pyg_type_get_custom(const gchar *name)
-{
-    CustomTypeData *data;
-    PyTypeObject *retval;
-
-    if (!custom_type_registration)
-       return NULL;
-
-    data = g_hash_table_lookup(custom_type_registration, name);
-    if (!data)
-       return NULL;
-
-    retval = data->callback(name, data->data);
-
-    g_hash_table_remove(custom_type_registration, name);
-
-    return retval;
-}
-
-GType
-_pyg_type_from_name(const gchar *name)
-{
-    GType type;
-
-    type = g_type_from_name(name);
-    if (type == G_TYPE_INVALID) {
-       pyg_type_get_custom(name);
-       type = g_type_from_name(name);
-    }
-
-    return type;
+    return g_type_get_qdata (gtype, pygobject_custom_key) != NULL;
 }
 
 static PyObject *
index db5adf5092fde93fcbb4ce07662bc6fd0b0949ed..dd0a90a807ff4a95c3c875907482941b9d8289b7 100644 (file)
@@ -119,7 +119,6 @@ class IntrospectionModule(object):
         self._version = version
         self.__name__ = 'gi.repository.' + namespace
 
-        repository.require(self._namespace, self._version)
         self.__path__ = repository.get_typelib_path(self._namespace)
         if _have_py3:
             # get_typelib_path() delivers bytes, not a string
index 3e660d1eed3d6f8abc78d2b8b07ab62e07a7ea56..7c512caaf93f647cdff0fa212deefd3f03414486 100644 (file)
@@ -44,11 +44,16 @@ GError = _glib.GError
 OptionContext = _glib.OptionContext
 OptionGroup = _glib.OptionGroup
 Pid = _glib.Pid
-PollFD = _glib.PollFD
 spawn_async = _glib.spawn_async
-threads_init = _glib.threads_init
 
-__all__ += ['GError', 'OptionContext', 'OptionGroup', 'Pid', 'PollFD',
+
+def threads_init():
+    warnings.warn('threads_init longer needs to be called. '
+                  'See: https://bugzilla.gnome.org/show_bug.cgi?id=686914',
+                  PyGIDeprecationWarning)
+
+
+__all__ += ['GError', 'OptionContext', 'OptionGroup', 'Pid',
             'spawn_async', 'threads_init']
 
 
@@ -789,6 +794,20 @@ IOChannel = override(IOChannel)
 __all__.append('IOChannel')
 
 
+class PollFD(GLib.PollFD):
+    def __new__(cls, fd, events):
+        pollfd = GLib.PollFD()
+        pollfd.__class__ = cls
+        return pollfd
+
+    def __init__(self, fd, events):
+        self.fd = fd
+        self.events = events
+
+PollFD = override(PollFD)
+__all__.append('PollFD')
+
+
 # The real GLib API is child_watch_add(priority, pid, callback, data).
 # The old static bindings had the following API which we still need to support
 # for a while:
index eea8928a17193b74d98a485592827b91528666c5..42c97a234e90c3ac6cf4c05705453130a87d1bf5 100644 (file)
@@ -198,7 +198,7 @@ features = _gobject.features
 list_properties = _gobject.list_properties
 new = _gobject.new
 pygobject_version = _gobject.pygobject_version
-threads_init = _gobject.threads_init
+threads_init = GLib.threads_init
 type_register = _gobject.type_register
 __all__ += ['features', 'list_properties', 'new',
             'pygobject_version', 'threads_init', 'type_register']
index ab09a2611ebcf6b502c9cf68e060c8739799ee6c..9a6e1a329cfa795fa7b402f086c22b6fd670c6e8 100644 (file)
@@ -115,7 +115,7 @@ class Editable(Gtk.Editable):
     def insert_text(self, text, position):
         return super(Editable, self).insert_text(text, -1, position)
 
-    get_selection_bounds = strip_boolean_result(Gtk.TextBuffer.get_selection_bounds, fail_ret=())
+    get_selection_bounds = strip_boolean_result(Gtk.Editable.get_selection_bounds, fail_ret=())
 
 
 Editable = override(Editable)
index feed8d46d0093f07e5d4b22c4a5c5412085b47c1..2d5e8089b77fe77bbd9faf4617ef6584105a4436 100644 (file)
@@ -208,6 +208,7 @@ PYTHON_LIBS = @PYTHON_LIBS@
 PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
index 4cf82d0ba981532a0803d0329ecbcd0cdb36121a..f477fdfb6f6f1f3e9bdf62839d00d342d817ab19 100644 (file)
@@ -999,32 +999,14 @@ _pygi_argument_from_object (PyObject   *object,
         }
         case GI_TYPE_TAG_FLOAT:
         {
-            PyObject *float_;
-
-            float_ = PyNumber_Float (object);
-            if (float_ == NULL) {
-                PyErr_SetString (PyExc_TypeError, "expected float or int argument");
-                break;
-            }
-
-            arg.v_float = (float) PyFloat_AsDouble (float_);
-            Py_DECREF (float_);
-
+            _pygi_marshal_from_py_float (NULL, NULL, NULL,
+                                         object, &arg);
             break;
         }
         case GI_TYPE_TAG_DOUBLE:
         {
-            PyObject *float_;
-
-            float_ = PyNumber_Float (object);
-            if (float_ == NULL) {
-                PyErr_SetString (PyExc_TypeError, "expected float or int argument");
-                break;
-            }
-
-            arg.v_double = PyFloat_AsDouble (float_);
-            Py_DECREF (float_);
-
+            _pygi_marshal_from_py_double (NULL, NULL, NULL,
+                                          object, &arg);
             break;
         }
         case GI_TYPE_TAG_GTYPE:
@@ -1035,104 +1017,20 @@ _pygi_argument_from_object (PyObject   *object,
         }
         case GI_TYPE_TAG_UNICHAR:
         {
-            gchar *string;
-
-            if (object == Py_None) {
-                arg.v_uint32 = 0;
-                break;
-            }
-
-#if PY_VERSION_HEX < 0x03000000
-            if (PyUnicode_Check(object)) {
-                 PyObject *pystr_obj = PyUnicode_AsUTF8String (object);
-
-                 if (!pystr_obj)
-                     break;
-
-                 string = g_strdup(PyString_AsString (pystr_obj));
-                 Py_DECREF(pystr_obj);
-            } else {
-                 string = g_strdup(PyString_AsString (object));
-            }
-#else
-            {
-                PyObject *pybytes_obj = PyUnicode_AsUTF8String (object);
-                if (!pybytes_obj)
-                    break;
-
-                string = g_strdup(PyBytes_AsString (pybytes_obj));
-                Py_DECREF (pybytes_obj);
-            }
-#endif
-
-            arg.v_uint32 = g_utf8_get_char (string);
-
+            _pygi_marshal_from_py_unichar (NULL, NULL, NULL,
+                                           object, &arg);
             break;
         }
         case GI_TYPE_TAG_UTF8:
         {
-            gchar *string;
-
-            if (object == Py_None) {
-                arg.v_string = NULL;
-                break;
-            }
-#if PY_VERSION_HEX < 0x03000000
-            if (PyUnicode_Check(object)) {
-                 PyObject *pystr_obj = PyUnicode_AsUTF8String (object);
-                 
-                 if (!pystr_obj)
-                     break;
-
-                 string = g_strdup(PyString_AsString (pystr_obj));
-                 Py_DECREF(pystr_obj);
-            } else {
-                 string = g_strdup(PyString_AsString (object));
-            }
-#else
-            {
-                PyObject *pybytes_obj = PyUnicode_AsUTF8String (object);
-                if (!pybytes_obj)
-                    break;
-
-                string = g_strdup(PyBytes_AsString (pybytes_obj));
-                Py_DECREF (pybytes_obj);
-            }
-#endif
-            arg.v_string = string;
-
+            _pygi_marshal_from_py_utf8 (NULL, NULL, NULL,
+                                        object, &arg);
             break;
         }
         case GI_TYPE_TAG_FILENAME:
         {
-            GError *error = NULL;
-            gchar *string;
-
-#if PY_VERSION_HEX < 0x03000000
-            string = g_strdup(PyString_AsString (object));
-#else
-            {
-                PyObject *pybytes_obj = PyUnicode_AsUTF8String (object);
-                if (!pybytes_obj)
-                    break;
-
-                string = g_strdup(PyBytes_AsString (pybytes_obj));
-                Py_DECREF (pybytes_obj);
-            }
-#endif
-
-            if (string == NULL) {
-                break;
-            }
-
-            arg.v_string = g_filename_from_utf8 (string, -1, NULL, NULL, &error);
-            g_free(string);
-
-            if (arg.v_string == NULL) {
-                PyErr_SetString (PyExc_Exception, error->message);
-                /* TODO: Convert the error to an exception. */
-            }
-
+            _pygi_marshal_from_py_filename (NULL, NULL, NULL,
+                                            object, &arg);
             break;
         }
         case GI_TYPE_TAG_ARRAY:
@@ -1245,56 +1143,31 @@ array_success:
                 case GI_INFO_TYPE_STRUCT:
                 case GI_INFO_TYPE_UNION:
                 {
-                    GType type;
-
-                    if (object == Py_None) {
-                        arg.v_pointer = NULL;
-                        break;
-                    }
-
-                    type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
-
-                    /* Handle special cases first. */
-                    if (g_type_is_a (type, G_TYPE_VALUE)) {
-                        g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
-                        /* This will currently leak the GValue that is allocated and
-                         * stashed in arg.v_pointer. Out argument marshaling for caller
-                         * allocated GValues already pass in memory for the GValue.
-                         * Further re-factoring is needed to fix this leak.
-                         * See: https://bugzilla.gnome.org/show_bug.cgi?id=693405
-                         */
-                        pygi_marshal_from_py_gvalue (object,
-                                                     &arg,
-                                                     transfer,
-                                                     FALSE /*is_allocated*/);
-
-                    } else if (g_type_is_a (type, G_TYPE_CLOSURE)) {
-                        pygi_marshal_from_py_gclosure (object, &arg);
-                    } else if (g_struct_info_is_foreign (info)) {
-                        pygi_struct_foreign_convert_to_g_argument (object, info, transfer, &arg);
-                    } else if (g_type_is_a (type, G_TYPE_BOXED)) {
-                        if (pyg_boxed_check (object, type)) {
-                            arg.v_pointer = pyg_boxed_get (object, void);
-                            if (transfer == GI_TRANSFER_EVERYTHING) {
-                                arg.v_pointer = g_boxed_copy (type, arg.v_pointer);
-                            }
-                        } else {
-                            PyErr_Format (PyExc_TypeError, "wrong boxed type");
-                        }
-                    } else if (g_type_is_a (type, G_TYPE_POINTER) || 
-                               g_type_is_a (type, G_TYPE_VARIANT) || 
-                               type == G_TYPE_NONE) {
-                        g_warn_if_fail (g_type_is_a (type, G_TYPE_VARIANT) || !g_type_info_is_pointer (type_info) || transfer == GI_TRANSFER_NOTHING);
-
-                        if (g_type_is_a (type, G_TYPE_VARIANT) && pyg_type_from_object (object) != G_TYPE_VARIANT) {
-                            PyErr_SetString (PyExc_TypeError, "expected GLib.Variant");
-                            break;
-                        }
-                        arg.v_pointer = pyg_pointer_get (object, void);
-                    } else {
-                        PyErr_Format (PyExc_NotImplementedError, "structure type '%s' is not supported yet", g_type_name (type));
-                    }
-
+                    GType g_type;
+                    PyObject *py_type;
+
+                    g_type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
+                    py_type = _pygi_type_import_by_gi_info ( (GIBaseInfo *) info);
+
+                    /* Note for G_TYPE_VALUE g_type:
+                     * This will currently leak the GValue that is allocated and
+                     * stashed in arg.v_pointer. Out argument marshaling for caller
+                     * allocated GValues already pass in memory for the GValue.
+                     * Further re-factoring is needed to fix this leak.
+                     * See: https://bugzilla.gnome.org/show_bug.cgi?id=693405
+                     */
+                    pygi_marshal_from_py_interface_struct (object,
+                                                           &arg,
+                                                           NULL, /*arg_name*/
+                                                           info, /*interface_info*/
+                                                           type_info,
+                                                           g_type,
+                                                           py_type,
+                                                           transfer,
+                                                           FALSE, /*is_caller_allocates*/
+                                                           g_struct_info_is_foreign (info));
+
+                    Py_DECREF (py_type);
                     break;
                 }
                 case GI_INFO_TYPE_ENUM:
@@ -1529,18 +1402,9 @@ _pygi_argument_to_object (GIArgument  *arg,
     switch (type_tag) {
         case GI_TYPE_TAG_VOID:
         {
-            if (g_type_info_is_pointer (type_info) &&
-                    (arg->v_pointer != NULL)) {
+            if (g_type_info_is_pointer (type_info)) {
                 g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
                 object = PyLong_FromVoidPtr (arg->v_pointer);
-            } else {
-                /* None is used instead of zero for parity with ctypes.
-                 * This is helpful in case the values are being used for
-                 * actual memory addressing, in which case None will
-                 * raise as opposed to 0 which will crash.
-                 */
-                object = Py_None;
-                Py_INCREF (object);
             }
             break;
         }
@@ -1606,56 +1470,20 @@ _pygi_argument_to_object (GIArgument  *arg,
         }
         case GI_TYPE_TAG_UNICHAR:
         {
-            /* Preserve the bidirectional mapping between 0 and "" */
-            if (arg->v_uint32 == 0) {
-                object = PYGLIB_PyUnicode_FromString ("");
-            } else if (g_unichar_validate (arg->v_uint32)) {
-                gchar utf8[6];
-                gint bytes;
-
-                bytes = g_unichar_to_utf8 (arg->v_uint32, utf8);
-                object = PYGLIB_PyUnicode_FromStringAndSize ((char*)utf8, bytes);
-            } else {
-                /* TODO: Convert the error to an exception. */
-                PyErr_Format (PyExc_TypeError,
-                              "Invalid unicode codepoint %" G_GUINT32_FORMAT,
-                              arg->v_uint32);
-                object = Py_None;
-                Py_INCREF (object);
-            }
+            object = _pygi_marshal_to_py_unichar (NULL, NULL, NULL,
+                                                  arg);
             break;
         }
         case GI_TYPE_TAG_UTF8:
-            if (arg->v_string == NULL) {
-                object = Py_None;
-                Py_INCREF (object);
-                break;
-            }
-
-            object = PYGLIB_PyUnicode_FromString (arg->v_string);
+        {
+            object = _pygi_marshal_to_py_utf8 (NULL, NULL, NULL,
+                                               arg);
             break;
+        }
         case GI_TYPE_TAG_FILENAME:
         {
-            GError *error = NULL;
-            gchar *string;
-
-            if (arg->v_string == NULL) {
-                object = Py_None;
-                Py_INCREF (object);
-                break;
-            }
-
-            string = g_filename_to_utf8 (arg->v_string, -1, NULL, NULL, &error);
-            if (string == NULL) {
-                PyErr_SetString (PyExc_Exception, error->message);
-                /* TODO: Convert the error to an exception. */
-                break;
-            }
-
-            object = PYGLIB_PyUnicode_FromString (string);
-
-            g_free (string);
-
+            object = _pygi_marshal_to_py_filename (NULL, NULL, NULL,
+                                                   arg);
             break;
         }
         case GI_TYPE_TAG_ARRAY:
@@ -1733,69 +1561,25 @@ _pygi_argument_to_object (GIArgument  *arg,
                 case GI_INFO_TYPE_STRUCT:
                 case GI_INFO_TYPE_UNION:
                 {
-                    GType type;
-
-                    if (arg->v_pointer == NULL) {
-                        object = Py_None;
-                        Py_INCREF (object);
-                        break;
-                    }
-
-                    type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
-                    if (g_type_is_a (type, G_TYPE_VALUE)) {
-                        object = pyg_value_as_pyobject (arg->v_pointer, FALSE);
-                    } else if (g_struct_info_is_foreign (info)) {
-                        object = pygi_struct_foreign_convert_from_g_argument (info, arg->v_pointer);
-                    } else if (g_type_is_a (type, G_TYPE_BOXED)) {
-                        PyObject *py_type;
-
-                        py_type = _pygi_type_get_from_g_type (type);
-                        if (py_type == NULL)
-                            break;
+                    PyObject *py_type;
+                    GType g_type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
 
-                        object = _pygi_boxed_new ( (PyTypeObject *) py_type, arg->v_pointer, transfer == GI_TRANSFER_EVERYTHING, 0);
-
-                        Py_DECREF (py_type);
-                    } else if (g_type_is_a (type, G_TYPE_POINTER)) {
-                        PyObject *py_type;
-
-                        py_type = _pygi_type_get_from_g_type (type);
-
-                        if (py_type == NULL || !PyType_IsSubtype ( (PyTypeObject *) type, &PyGIStruct_Type)) {
-                            g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
-                            object = pyg_pointer_new (type, arg->v_pointer);
-                        } else {
-                            object = _pygi_struct_new ( (PyTypeObject *) py_type, arg->v_pointer, transfer == GI_TRANSFER_EVERYTHING);
-                        }
-
-                        Py_XDECREF (py_type);
-                   } else if (type == G_TYPE_VARIANT) {
-                        PyObject *py_type;
-
-                        g_variant_ref_sink (arg->v_pointer);
+                    /* Special case variant and none to force loading from py module. */
+                    if (g_type == G_TYPE_VARIANT || g_type == G_TYPE_NONE) {
                         py_type = _pygi_type_import_by_gi_info (info);
-                        object = _pygi_struct_new ( (PyTypeObject *) py_type, arg->v_pointer,
-                                                    transfer == GI_TRANSFER_EVERYTHING);
-                    } else if (type == G_TYPE_NONE) {
-                        PyObject *py_type;
-
-                        py_type = _pygi_type_import_by_gi_info (info);
-                        if (py_type == NULL) {
-                            break;
-                        }
-
-                        /* Only structs created in invoke can be safely marked
-                         * GI_TRANSFER_EVERYTHING. Trust that invoke has
-                         * filtered correctly
-                         */
-                        object = _pygi_struct_new ( (PyTypeObject *) py_type, arg->v_pointer,
-                                                    transfer == GI_TRANSFER_EVERYTHING);
-
-                        Py_DECREF (py_type);
                     } else {
-                        PyErr_Format (PyExc_NotImplementedError, "structure type '%s' is not supported yet", g_type_name (type));
+                        py_type = _pygi_type_get_from_g_type (g_type);
                     }
 
+                    object = pygi_marshal_to_py_interface_struct (arg,
+                                                                  info, /*interface_info*/
+                                                                  g_type,
+                                                                  py_type,
+                                                                  transfer,
+                                                                  FALSE, /*is_allocated*/
+                                                                  g_struct_info_is_foreign (info));
+
+                    Py_XDECREF (py_type);
                     break;
                 }
                 case GI_INFO_TYPE_ENUM:
@@ -1828,7 +1612,7 @@ _pygi_argument_to_object (GIArgument  *arg,
                     } else if (info_type == GI_INFO_TYPE_ENUM) {
                         object = pyg_enum_from_gtype (type, arg->v_int);
                     } else {
-                        object = pyg_flags_from_gtype (type, arg->v_int);
+                        object = pyg_flags_from_gtype (type, arg->v_uint);
                     }
 
                     break;
@@ -2082,10 +1866,10 @@ _pygi_argument_from_g_value(const GValue *value,
 
             switch (info_type) {
                 case GI_INFO_TYPE_FLAGS:
-                    arg.v_long = g_value_get_flags (value);
+                    arg.v_uint = g_value_get_flags (value);
                     break;
                 case GI_INFO_TYPE_ENUM:
-                    arg.v_long = g_value_get_enum (value);
+                    arg.v_int = g_value_get_enum (value);
                     break;
                 case GI_INFO_TYPE_INTERFACE:
                 case GI_INFO_TYPE_OBJECT:
index 99f49cf59fae008a13f8dbccd9254a42a16e847d..d149732b96f3d05ae9c8c02e7eb30b42ac6c574b 100644 (file)
@@ -756,6 +756,7 @@ _arg_cache_new_for_interface (GIInterfaceInfo *iface_info,
                _arg_cache_to_py_interface_union_setup (arg_cache, transfer);
 
             break;
+        case GI_INFO_TYPE_BOXED:
         case GI_INFO_TYPE_STRUCT:
             if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
                _arg_cache_from_py_interface_struct_setup (arg_cache,
@@ -776,17 +777,6 @@ _arg_cache_new_for_interface (GIInterfaceInfo *iface_info,
                _arg_cache_to_py_interface_object_setup (arg_cache, transfer);
 
             break;
-        case GI_INFO_TYPE_BOXED:
-            if (direction == PYGI_DIRECTION_FROM_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
-                _arg_cache_from_py_interface_struct_setup (arg_cache,
-                                                       iface_info,
-                                                       transfer);
-
-            if (direction == PYGI_DIRECTION_TO_PYTHON || direction == PYGI_DIRECTION_BIDIRECTIONAL)
-                _arg_cache_to_py_interface_struct_setup (arg_cache,
-                                                      iface_info,
-                                                      transfer);
-            break;
         case GI_INFO_TYPE_CALLBACK:
             {
                 PyGICallbackCache *callback_cache;
index 362e7cdb5688915221ac7541bf51dd5d90ba3323..1229d784eaf78b2955da8b530e4df131962e2271 100644 (file)
@@ -90,8 +90,8 @@ _base_info_richcompare (PyGIBaseInfo *self, PyObject *other, int op)
 
 PYGLIB_DEFINE_TYPE("gi.BaseInfo", PyGIBaseInfo_Type, PyGIBaseInfo);
 
-static PyObject *
-_wrap_g_base_info_get_name (PyGIBaseInfo *self)
+gboolean
+_pygi_is_python_keyword (const gchar *name)
 {
     /* It may be better to use keyword.iskeyword(); keep in sync with
      * python -c 'import keyword; print(keyword.kwlist)' */
@@ -115,20 +115,32 @@ _wrap_g_base_info_get_name (PyGIBaseInfo *self)
     #error Need keyword list for this major Python version
 #endif
 
-    const gchar *name, **i;
-
-    name = g_base_info_get_name (self->info);
+    const gchar **i;
 
-    /* escape keywords */
     for (i = keywords; *i != NULL; ++i) {
         if (strcmp (name, *i) == 0) {
-            gchar *escaped = g_strconcat (name, "_", NULL);
-            PyObject *obj = PYGLIB_PyUnicode_FromString (escaped);
-            g_free (escaped);
-            return obj;
+            return TRUE;
         }
     }
 
+    return FALSE;
+}
+
+static PyObject *
+_wrap_g_base_info_get_name (PyGIBaseInfo *self)
+{
+    const gchar *name;
+
+    name = g_base_info_get_name (self->info);
+
+    /* escape keywords */
+    if (_pygi_is_python_keyword (name)) {
+        gchar *escaped = g_strconcat (name, "_", NULL);
+        PyObject *obj = PYGLIB_PyUnicode_FromString (escaped);
+        g_free (escaped);
+        return obj;
+    }
+
     return PYGLIB_PyUnicode_FromString (name);
 }
 
@@ -419,11 +431,19 @@ _g_arg_get_pytype_hint (PyGIBaseInfo *self)
     } else {
        Py_DecRef(py_type);
        if (type_tag == GI_TYPE_TAG_INTERFACE) {
+           const char *info_name;
+           PyObject *py_string;
            GIBaseInfo *iface = g_type_info_get_interface(&type_info);
+
+           info_name = g_base_info_get_name (iface);
+           if (info_name == NULL) {
+               g_base_info_unref (iface);
+               return PYGLIB_PyUnicode_FromString(g_type_tag_to_string(type_tag));
+           }
+
            gchar *name = g_strdup_printf("%s.%s",
                    g_base_info_get_namespace(iface),
-                   g_base_info_get_name (iface));
-        PyObject *py_string;
+                   info_name);
            g_base_info_unref(iface);
            py_string = PYGLIB_PyUnicode_FromString(name);
            g_free(name);
@@ -1156,6 +1176,20 @@ _wrap_g_object_info_get_abstract (PyGIBaseInfo *self)
     return PyBool_FromLong (is_abstract);
 }
 
+static PyObject *
+_wrap_g_object_info_get_class_struct (PyGIBaseInfo *self)
+{
+    GIBaseInfo *info;
+
+    info = g_object_info_get_class_struct ((GIObjectInfo*)self->info);
+
+    if (info == NULL) {
+        Py_RETURN_NONE;
+    }
+
+    return _pygi_info_new (info);
+}
+
 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 },
@@ -1164,6 +1198,7 @@ static PyMethodDef _PyGIObjectInfo_methods[] = {
     { "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 },
+    { "get_class_struct", (PyCFunction) _wrap_g_object_info_get_class_struct, METH_NOARGS },
     { NULL, NULL, 0 }
 };
 
index afd65dc699b311a51a77396d714fe598264730bd..d550d8dea96e368a4e184175bf7186a779d05a6f 100644 (file)
@@ -68,6 +68,8 @@ gsize _pygi_g_type_info_size (GITypeInfo *type_info);
 
 void _pygi_info_register_types (PyObject *m);
 
+gboolean _pygi_is_python_keyword (const gchar *name);
+
 G_END_DECLS
 
 #endif /* __PYGI_INFO_H__ */
index 11115455aed017ca9832f09294d420e14d0dc2f4..639a226c11f37f99fdccd398c69c24e4162c7386 100644 (file)
@@ -194,19 +194,19 @@ gi_argument_from_c_long (GIArgument *arg_out,
  * expected C union
  */
 static gboolean
-_is_union_member (PyGIInterfaceCache *iface_cache, PyObject *py_arg) {
+_is_union_member (GIInterfaceInfo *interface_info, PyObject *py_arg) {
     gint i;
     gint n_fields;
     GIUnionInfo *union_info;
     GIInfoType info_type;
     gboolean is_member = FALSE;
 
-    info_type = g_base_info_get_type (iface_cache->interface_info);
+    info_type = g_base_info_get_type (interface_info);
 
     if (info_type != GI_INFO_TYPE_UNION)
         return FALSE;
 
-    union_info = (GIUnionInfo *) iface_cache->interface_info;
+    union_info = (GIUnionInfo *) interface_info;
     n_fields = g_union_info_get_n_fields (union_info);
 
     for (i = 0; i < n_fields; i++) {
@@ -696,15 +696,10 @@ check_valid_double (double x, double min, double max)
     return TRUE;
 }
 
-gboolean
-_pygi_marshal_from_py_float (PyGIInvokeState   *state,
-                             PyGICallableCache *callable_cache,
-                             PyGIArgCache      *arg_cache,
-                             PyObject          *py_arg,
-                             GIArgument        *arg)
+static gboolean
+_pygi_py_arg_to_double (PyObject *py_arg, double *double_)
 {
     PyObject *py_float;
-    double double_;
 
     if (!PyNumber_Check (py_arg)) {
         PyErr_Format (PyExc_TypeError, "Must be number, not %s",
@@ -716,14 +711,29 @@ _pygi_marshal_from_py_float (PyGIInvokeState   *state,
     if (!py_float)
         return FALSE;
 
-    double_ = PyFloat_AsDouble (py_float);
+    *double_ = PyFloat_AsDouble (py_float);
     Py_DECREF (py_float);
 
+
+    return TRUE;
+}
+
+gboolean
+_pygi_marshal_from_py_float (PyGIInvokeState   *state,
+                             PyGICallableCache *callable_cache,
+                             PyGIArgCache      *arg_cache,
+                             PyObject          *py_arg,
+                             GIArgument        *arg)
+{
+    double double_;
+
+    if (!_pygi_py_arg_to_double (py_arg, &double_))
+        return FALSE;
+
     if (PyErr_Occurred () || !check_valid_double (double_, -G_MAXFLOAT, G_MAXFLOAT))
         return FALSE;
 
     arg->v_float = double_;
-
     return TRUE;
 }
 
@@ -734,27 +744,15 @@ _pygi_marshal_from_py_double (PyGIInvokeState   *state,
                               PyObject          *py_arg,
                               GIArgument        *arg)
 {
-    PyObject *py_float;
     double double_;
 
-    if (!PyNumber_Check (py_arg)) {
-        PyErr_Format (PyExc_TypeError, "Must be number, not %s",
-                      py_arg->ob_type->tp_name);
-        return FALSE;
-    }
-
-    py_float = PyNumber_Float (py_arg);
-    if (!py_float)
+    if (!_pygi_py_arg_to_double (py_arg, &double_))
         return FALSE;
 
-    double_ = PyFloat_AsDouble (py_float);
-    Py_DECREF (py_float);
-
     if (PyErr_Occurred () || !check_valid_double (double_, -G_MAXDOUBLE, G_MAXDOUBLE))
         return FALSE;
 
     arg->v_double = double_;
-
     return TRUE;
 }
 
@@ -768,12 +766,20 @@ _pygi_marshal_from_py_unichar (PyGIInvokeState   *state,
     Py_ssize_t size;
     gchar *string_;
 
+    if (py_arg == Py_None) {
+        arg->v_uint32 = 0;
+        return FALSE;
+    }
+
     if (PyUnicode_Check (py_arg)) {
        PyObject *py_bytes;
 
        size = PyUnicode_GET_SIZE (py_arg);
        py_bytes = PyUnicode_AsUTF8String (py_arg);
-       string_ = strdup(PYGLIB_PyBytes_AsString (py_bytes));
+       if (!py_bytes)
+           return FALSE;
+
+       string_ = g_strdup(PYGLIB_PyBytes_AsString (py_bytes));
        Py_DECREF (py_bytes);
 
 #if PY_VERSION_HEX < 0x03000000
@@ -804,6 +810,7 @@ _pygi_marshal_from_py_unichar (PyGIInvokeState   *state,
 
     return TRUE;
 }
+
 gboolean
 _pygi_marshal_from_py_gtype (PyGIInvokeState   *state,
                              PyGICallableCache *callable_cache,
@@ -1636,65 +1643,16 @@ _pygi_marshal_from_py_interface_struct (PyGIInvokeState   *state,
 {
     PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
 
-    if (py_arg == Py_None) {
-        arg->v_pointer = NULL;
-        return TRUE;
-    }
-
-    /* FIXME: handle this large if statement in the cache
-     *        and set the correct marshaller
-     */
-
-    if (iface_cache->g_type == G_TYPE_CLOSURE) {
-        return pygi_marshal_from_py_gclosure (py_arg, arg);
-    } else if (iface_cache->g_type == G_TYPE_VALUE) {
-        return pygi_marshal_from_py_gvalue(py_arg, arg,
-                                           arg_cache->transfer,
-                                           arg_cache->is_caller_allocates);
-    } else if (iface_cache->is_foreign) {
-        PyObject *success;
-        success = pygi_struct_foreign_convert_to_g_argument (py_arg,
-                                                             iface_cache->interface_info,
-                                                             arg_cache->transfer,
-                                                             arg);
-
-        return (success == Py_None);
-    } else if (!PyObject_IsInstance (py_arg, iface_cache->py_type)) {
-        /* first check to see if this is a member of the expected union */
-        if (!_is_union_member (iface_cache, py_arg)) {
-            if (!PyErr_Occurred()) {
-                PyObject *module = PyObject_GetAttrString(py_arg, "__module__");
-
-                PyErr_Format (PyExc_TypeError, "argument %s: Expected %s, but got %s%s%s",
-                              arg_cache->arg_name ? arg_cache->arg_name : "self",
-                              iface_cache->type_name,
-                              module ? PYGLIB_PyUnicode_AsString(module) : "",
-                              module ? "." : "",
-                              py_arg->ob_type->tp_name);
-                if (module)
-                    Py_DECREF (module);
-            }
-
-            return FALSE;
-        }
-    }
-
-    if (g_type_is_a (iface_cache->g_type, G_TYPE_BOXED)) {
-        arg->v_pointer = pyg_boxed_get (py_arg, void);
-        if (arg_cache->transfer == GI_TRANSFER_EVERYTHING) {
-            arg->v_pointer = g_boxed_copy (iface_cache->g_type, arg->v_pointer);
-        }
-    } else if (g_type_is_a (iface_cache->g_type, G_TYPE_POINTER) ||
-                   g_type_is_a (iface_cache->g_type, G_TYPE_VARIANT) ||
-                       iface_cache->g_type  == G_TYPE_NONE) {
-        arg->v_pointer = pyg_pointer_get (py_arg, void);
-    } else {
-        PyErr_Format (PyExc_NotImplementedError,
-                      "structure type '%s' is not supported yet",
-                      g_type_name(iface_cache->g_type));
-        return FALSE;
-    }
-    return TRUE;
+    return pygi_marshal_from_py_interface_struct (py_arg,
+                                                  arg,
+                                                  arg_cache->arg_name,
+                                                  iface_cache->interface_info,
+                                                  arg_cache->type_info,
+                                                  iface_cache->g_type,
+                                                  iface_cache->py_type,
+                                                  arg_cache->transfer,
+                                                  arg_cache->is_caller_allocates,
+                                                  iface_cache->is_foreign);
 }
 
 gboolean
@@ -1768,7 +1726,7 @@ gboolean _pygi_marshal_from_py_interface_instance (PyGIInvokeState   *state,
 
             if (!PyObject_IsInstance (py_arg, iface_cache->py_type)) {
                 /* wait, we might be a member of a union so manually check */
-                if (!_is_union_member (iface_cache, py_arg)) {
+                if (!_is_union_member (iface_cache->interface_info, py_arg)) {
                     if (!PyErr_Occurred()) {
                         PyObject *module = PyObject_GetAttrString(py_arg, "__module__");
                         PyErr_Format (PyExc_TypeError,
@@ -1972,3 +1930,93 @@ pygi_marshal_from_py_gclosure(PyObject *py_arg,
     arg->v_pointer = closure;
     return TRUE;
 }
+
+gboolean
+pygi_marshal_from_py_interface_struct (PyObject *py_arg,
+                                       GIArgument *arg,
+                                       const gchar *arg_name,
+                                       GIBaseInfo *interface_info,
+                                       GITypeInfo *type_info,
+                                       GType g_type,
+                                       PyObject *py_type,
+                                       GITransfer transfer,
+                                       gboolean is_allocated,
+                                       gboolean is_foreign)
+{
+    if (py_arg == Py_None) {
+        arg->v_pointer = NULL;
+        return TRUE;
+    }
+
+    /* FIXME: handle this large if statement in the cache
+     *        and set the correct marshaller
+     */
+
+    if (g_type_is_a (g_type, G_TYPE_CLOSURE)) {
+        return pygi_marshal_from_py_gclosure (py_arg, arg);
+    } else if (g_type_is_a (g_type, G_TYPE_VALUE)) {
+        return pygi_marshal_from_py_gvalue(py_arg,
+                                           arg,
+                                           transfer,
+                                           is_allocated);
+    } else if (is_foreign) {
+        PyObject *success;
+        success = pygi_struct_foreign_convert_to_g_argument (py_arg,
+                                                             interface_info,
+                                                             transfer,
+                                                             arg);
+
+        return (success == Py_None);
+    } else if (!PyObject_IsInstance (py_arg, py_type)) {
+        /* first check to see if this is a member of the expected union */
+        if (!_is_union_member (interface_info, py_arg)) {
+            if (!PyErr_Occurred()) {
+                gchar *type_name = _pygi_g_base_info_get_fullname (interface_info);
+                PyObject *module = PyObject_GetAttrString(py_arg, "__module__");
+
+                PyErr_Format (PyExc_TypeError, "argument %s: Expected %s, but got %s%s%s",
+                              arg_name ? arg_name : "self",
+                              type_name,
+                              module ? PYGLIB_PyUnicode_AsString(module) : "",
+                              module ? "." : "",
+                              py_arg->ob_type->tp_name);
+                if (module)
+                    Py_DECREF (module);
+                g_free (type_name);
+            }
+
+            return FALSE;
+        }
+    }
+
+    if (g_type_is_a (g_type, G_TYPE_BOXED)) {
+        if (pyg_boxed_check (py_arg, g_type)) {
+            arg->v_pointer = pyg_boxed_get (py_arg, void);
+            if (transfer == GI_TRANSFER_EVERYTHING) {
+                arg->v_pointer = g_boxed_copy (g_type, arg->v_pointer);
+            }
+        } else {
+            PyErr_Format (PyExc_TypeError, "wrong boxed type");
+            return FALSE;
+        }
+
+    } else if (g_type_is_a (g_type, G_TYPE_POINTER) ||
+               g_type_is_a (g_type, G_TYPE_VARIANT) ||
+               g_type  == G_TYPE_NONE) {
+        g_warn_if_fail (g_type_is_a (g_type, G_TYPE_VARIANT) || !g_type_info_is_pointer (type_info) || transfer == GI_TRANSFER_NOTHING);
+
+        if (g_type_is_a (g_type, G_TYPE_VARIANT) &&
+                pyg_type_from_object (py_arg) != G_TYPE_VARIANT) {
+            PyErr_SetString (PyExc_TypeError, "expected GLib.Variant");
+            return FALSE;
+        }
+        arg->v_pointer = pyg_pointer_get (py_arg, void);
+
+    } else {
+        PyErr_Format (PyExc_NotImplementedError,
+                      "structure type '%s' is not supported yet",
+                      g_type_name(g_type));
+        return FALSE;
+    }
+    return TRUE;
+}
index e0a57d3f335d393a0970a770091dd386280d1364..307d7162662a869a640914ebd97bfc94c137493a 100644 (file)
@@ -198,6 +198,17 @@ gboolean pygi_marshal_from_py_gvalue (PyObject *py_arg, /*in*/
 gboolean pygi_marshal_from_py_gclosure(PyObject *py_arg, /*in*/
                                        GIArgument *arg); /*out*/
 
+gboolean pygi_marshal_from_py_interface_struct (PyObject *py_arg,
+                                                GIArgument *arg,
+                                                const gchar *arg_name,
+                                                GIBaseInfo *interface_info,
+                                                GITypeInfo *type_info,
+                                                GType g_type,
+                                                PyObject *py_type,
+                                                GITransfer transfer,
+                                                gboolean is_allocated,
+                                                gboolean is_foreign);
+
 G_END_DECLS
 
 #endif /* __PYGI_MARSHAL_from_py_PY__ */
index 6dde41d2bffe0f8af59927070e1edd667a662bcd..6e16b9939939f2244b43cc9ba4c011309b3b5412 100644 (file)
@@ -293,9 +293,7 @@ _pygi_marshal_to_py_utf8 (PyGIInvokeState   *state,
 {
     PyObject *py_obj = NULL;
     if (arg->v_string == NULL) {
-        py_obj = Py_None;
-        Py_INCREF (py_obj);
-        return py_obj;
+        Py_RETURN_NONE;
      }
 
     py_obj = PYGLIB_PyUnicode_FromString (arg->v_string);
@@ -308,14 +306,12 @@ _pygi_marshal_to_py_filename (PyGIInvokeState   *state,
                               PyGIArgCache      *arg_cache,
                               GIArgument        *arg)
 {
-    gchar *string;
+    gchar *string = NULL;
     PyObject *py_obj = NULL;
     GError *error = NULL;
 
     if (arg->v_string == NULL) {
-        py_obj = Py_None;
-        Py_INCREF (py_obj);
-        return py_obj;
+        Py_RETURN_NONE;
     }
 
     string = g_filename_to_utf8 (arg->v_string, -1, NULL, NULL, &error);
@@ -799,51 +795,15 @@ _pygi_marshal_to_py_interface_struct (PyGIInvokeState   *state,
                                       PyGIArgCache      *arg_cache,
                                       GIArgument        *arg)
 {
-    PyObject *py_obj = NULL;
     PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
-    GType type = iface_cache->g_type;
-
-    if (arg->v_pointer == NULL) {
-        py_obj = Py_None;
-        Py_INCREF (py_obj);
-        return py_obj;
-    }
-
-    if (g_type_is_a (type, G_TYPE_VALUE)) {
-        py_obj = pyg_value_as_pyobject (arg->v_pointer, FALSE);
-    } else if (iface_cache->is_foreign) {
-        py_obj = pygi_struct_foreign_convert_from_g_argument (iface_cache->interface_info,
-                                                              arg->v_pointer);
-    } else if (g_type_is_a (type, G_TYPE_BOXED)) {
-        py_obj = _pygi_boxed_new ( (PyTypeObject *)iface_cache->py_type, arg->v_pointer,
-                                  arg_cache->transfer == GI_TRANSFER_EVERYTHING || arg_cache->is_caller_allocates,
-                                  arg_cache->is_caller_allocates ?
-                                          g_struct_info_get_size(iface_cache->interface_info) : 0);
-    } else if (g_type_is_a (type, G_TYPE_POINTER)) {
-        if (iface_cache->py_type == NULL ||
-                !PyType_IsSubtype ( (PyTypeObject *)iface_cache->py_type, &PyGIStruct_Type)) {
-            g_warn_if_fail(arg_cache->transfer == GI_TRANSFER_NOTHING);
-            py_obj = pyg_pointer_new (type, arg->v_pointer);
-        } else {
-            py_obj = _pygi_struct_new ( (PyTypeObject *)iface_cache->py_type, arg->v_pointer, 
-                                       arg_cache->transfer == GI_TRANSFER_EVERYTHING);
-        }
-    } else if (g_type_is_a (type, G_TYPE_VARIANT)) {
-         g_variant_ref_sink (arg->v_pointer);
-         py_obj = _pygi_struct_new ( (PyTypeObject *)iface_cache->py_type, arg->v_pointer, 
-                                    FALSE);
-    } else if (type == G_TYPE_NONE && iface_cache->is_foreign) {
-        py_obj = pygi_struct_foreign_convert_from_g_argument (iface_cache->interface_info, arg->v_pointer);
-    } else if (type == G_TYPE_NONE) {
-        py_obj = _pygi_struct_new ( (PyTypeObject *) iface_cache->py_type, arg->v_pointer, 
-                                   arg_cache->transfer == GI_TRANSFER_EVERYTHING);
-    } else {
-        PyErr_Format (PyExc_NotImplementedError,
-                      "structure type '%s' is not supported yet",
-                      g_type_name (type));
-    }
 
-    return py_obj;
+    return pygi_marshal_to_py_interface_struct (arg,
+                                                iface_cache->interface_info,
+                                                iface_cache->g_type,
+                                                iface_cache->py_type,
+                                                arg_cache->transfer,
+                                                arg_cache->is_caller_allocates,
+                                                iface_cache->is_foreign);
 }
 
 PyObject *
@@ -915,3 +875,65 @@ pygi_marshal_to_py_object (GIArgument *arg, GITransfer transfer) {
 
     return pyobj;
 }
+
+PyObject *
+pygi_marshal_to_py_interface_struct (GIArgument *arg,
+                                     GIInterfaceInfo *interface_info,
+                                     GType g_type,
+                                     PyObject *py_type,
+                                     GITransfer transfer,
+                                     gboolean is_allocated,
+                                     gboolean is_foreign)
+{
+    PyObject *py_obj = NULL;
+
+    if (arg->v_pointer == NULL) {
+        Py_RETURN_NONE;
+    }
+
+    if (g_type_is_a (g_type, G_TYPE_VALUE)) {
+        py_obj = pyg_value_as_pyobject (arg->v_pointer, FALSE);
+    } else if (is_foreign) {
+        py_obj = pygi_struct_foreign_convert_from_g_argument (interface_info,
+                                                              arg->v_pointer);
+    } else if (g_type_is_a (g_type, G_TYPE_BOXED)) {
+        if (py_type) {
+            py_obj = _pygi_boxed_new ((PyTypeObject *) py_type,
+                                      arg->v_pointer,
+                                      transfer == GI_TRANSFER_EVERYTHING || is_allocated,
+                                      is_allocated ?
+                                              g_struct_info_get_size(interface_info) : 0);
+        }
+    } else if (g_type_is_a (g_type, G_TYPE_POINTER)) {
+        if (py_type == NULL ||
+                !PyType_IsSubtype ((PyTypeObject *) py_type, &PyGIStruct_Type)) {
+            g_warn_if_fail (transfer == GI_TRANSFER_NOTHING);
+            py_obj = pyg_pointer_new (g_type, arg->v_pointer);
+        } else {
+            py_obj = _pygi_struct_new ( (PyTypeObject *) py_type,
+                                       arg->v_pointer,
+                                       transfer == GI_TRANSFER_EVERYTHING);
+        }
+    } else if (g_type_is_a (g_type, G_TYPE_VARIANT)) {
+        /* Note we do not use transfer for the structs free_on_dealloc because
+         * GLib.Variant overrides __del__ to call "g_variant_unref". */
+        if (py_type) {
+            g_variant_ref_sink (arg->v_pointer);
+            py_obj = _pygi_struct_new ((PyTypeObject *) py_type,
+                                       arg->v_pointer,
+                                       FALSE);
+        }
+    } else if (g_type == G_TYPE_NONE) {
+        if (py_type) {
+            py_obj = _pygi_struct_new ((PyTypeObject *) py_type,
+                                       arg->v_pointer,
+                                       transfer == GI_TRANSFER_EVERYTHING);
+        }
+    } else {
+        PyErr_Format (PyExc_NotImplementedError,
+                      "structure type '%s' is not supported yet",
+                      g_type_name (g_type));
+    }
+
+    return py_obj;
+}
index f2e1a5ca7bf8a07d8a9d6c48c6a698484e9e0ed4..359644deaf3075faa8955dbf8e85a6cf060e6501 100644 (file)
@@ -144,6 +144,14 @@ PyObject *_pygi_marshal_to_py_interface_union  (PyGIInvokeState   *state,
 PyObject *pygi_marshal_to_py_object (GIArgument *arg,
                                      GITransfer transfer);
 
+PyObject *pygi_marshal_to_py_interface_struct (GIArgument *arg,
+                                               GIInterfaceInfo *interface_info,
+                                               GType g_type,
+                                               PyObject *py_type,
+                                               GITransfer transfer,
+                                               gboolean is_allocated,
+                                               gboolean is_foreign);
+
 G_END_DECLS
 
 #endif /* __PYGI_MARSHAL_TO_PY_H__ */
index ae49f0882540209c568253bc6baf24a2d5ce919c..3f6d0383bda47e1794ef5d6986949766a70b68b3 100644 (file)
@@ -192,7 +192,7 @@ pygi_get_property_value_real (PyGObject *instance, GParamSpec *pspec)
 
             switch (info_type) {
                 case GI_INFO_TYPE_ENUM:
-                    arg.v_int32 = g_value_get_enum (&value);
+                    arg.v_int = g_value_get_enum (&value);
                     break;
                 case GI_INFO_TYPE_INTERFACE:
                 case GI_INFO_TYPE_OBJECT:
@@ -319,7 +319,7 @@ pygi_set_property_value_real (PyGObject *instance,
 
             switch (info_type) {
                 case GI_INFO_TYPE_ENUM:
-                    g_value_set_enum (&value, arg.v_int32);
+                    g_value_set_enum (&value, arg.v_int);
                     break;
                 case GI_INFO_TYPE_INTERFACE:
                 case GI_INFO_TYPE_OBJECT:
@@ -336,8 +336,9 @@ pygi_set_property_value_real (PyGObject *instance,
                         PyErr_Format (PyExc_NotImplementedError,
                                       "Setting properties of type '%s' is not implemented",
                                       g_type_name (type));
+                        goto out;
                     }
-                    goto out;
+                    break;
                 default:
                     PyErr_Format (PyExc_NotImplementedError,
                                   "Setting properties of type '%s' is not implemented",
index d54326debf43cd53e44fe4181a6e5fe7ce0d4368..d7c65f5f2c5aea5fe07ee6a432ce3bcc1f7deef0 100644 (file)
@@ -120,13 +120,29 @@ _wrap_g_irepository_find_by_name (PyGIRepository *self,
     const char *name;
     GIBaseInfo *info;
     PyObject *py_info;
+    size_t len;
+    char *trimmed_name = NULL;
 
     if (!PyArg_ParseTupleAndKeywords (args, kwargs,
                                       "ss:Repository.find_by_name", kwlist, &namespace_, &name)) {
         return NULL;
     }
 
+    /* If the given name ends with an underscore, it might be due to usage
+     * as an accessible replacement for something in GI with the same name
+     * as a Python keyword. Test for this and trim it out if necessary.
+     */
+    len = strlen (name);
+    if (len > 0 && name[len-1] == '_') {
+        trimmed_name = g_strndup (name, len-1);
+        if (_pygi_is_python_keyword (trimmed_name)) {
+            name = trimmed_name;
+        }
+    }
+
     info = g_irepository_find_by_name (self->repository, namespace_, name);
+    g_free (trimmed_name);
+
     if (info == NULL) {
         Py_RETURN_NONE;
     }
index 6e026def5845c3daaca1879914be0854d287c178..20c6b56306ed8c3509f4e6eda5c14e0da2136b3e 100644 (file)
 
 #include "pygi-private.h"
 
-/* Copied from glib */
-static void
-canonicalize_key (gchar *key)
-{
-    gchar *p;
-
-    for (p = key; *p != 0; p++)
-    {
-        gchar c = *p;
-
-        if (c != '-' &&
-            (c < '0' || c > '9') &&
-            (c < 'A' || c > 'Z') &&
-            (c < 'a' || c > 'z'))
-                *p = '-';
-    }
-}
-
 static GISignalInfo *
 _pygi_lookup_signal_from_g_type (GType g_type,
                                  const gchar *signal_name)
 {
     GIRepository *repository;
     GIBaseInfo *info;
-    GType parent;
+    GISignalInfo *signal_info = NULL;
 
     repository = g_irepository_get_default();
     info = g_irepository_find_by_gtype (repository, g_type);
-    if (info != NULL) {
-        GISignalInfo *signal_info;
-        signal_info = g_object_info_find_signal ((GIObjectInfo *) info, signal_name);
-        g_base_info_unref (info);
-        if (signal_info != NULL)
-            return signal_info;
-    }
-
-    parent = g_type_parent (g_type);
-    if (parent > 0)
-        return _pygi_lookup_signal_from_g_type (parent, signal_name);
-
-    return NULL;
+    if (info == NULL)
+        return NULL;
+
+    if (GI_IS_OBJECT_INFO (info))
+        signal_info = g_object_info_find_signal ((GIObjectInfo *) info,
+                                                 signal_name);
+    else if (GI_IS_INTERFACE_INFO (info))
+        signal_info = g_interface_info_find_signal ((GIInterfaceInfo *) info,
+                                                    signal_name);
+
+    g_base_info_unref (info);
+    return signal_info;
 }
 
 static void
@@ -192,26 +173,21 @@ pygi_signal_closure_marshal(GClosure *closure,
 
 GClosure *
 pygi_signal_closure_new_real (PyGObject *instance,
-                              const gchar *sig_name,
+                              GType g_type,
+                              const gchar *signal_name,
                               PyObject *callback,
                               PyObject *extra_args,
                               PyObject *swap_data)
 {
     GClosure *closure = NULL;
     PyGISignalClosure *pygi_closure = NULL;
-    GType g_type;
     GISignalInfo *signal_info = NULL;
-    char *signal_name = g_strdup (sig_name);
 
     g_return_val_if_fail(callback != NULL, NULL);
 
-    canonicalize_key(signal_name);
-
-    g_type = pyg_type_from_object ((PyObject *)instance);
     signal_info = _pygi_lookup_signal_from_g_type (g_type, signal_name);
-
     if (signal_info == NULL)
-        goto out;
+        return NULL;
 
     closure = g_closure_new_simple(sizeof(PyGISignalClosure), NULL);
     g_closure_add_invalidate_notifier(closure, NULL, pygi_signal_closure_invalidate);
@@ -238,8 +214,5 @@ pygi_signal_closure_new_real (PyGObject *instance,
         closure->derivative_flag = TRUE;
     }
 
-out:
-    g_free (signal_name);
-
     return closure;
 }
index 4687f3f7418b01ca7a80cd9ea79f36f27f2e9607..ffdd29c4d76e9e488a93762c50172901aa9f8bde 100644 (file)
@@ -36,6 +36,7 @@ typedef struct _PyGISignalClosure
 } PyGISignalClosure;
 
 GClosure * pygi_signal_closure_new_real (PyGObject *instance,
+                                         GType g_type,
                                          const gchar *sig_name,
                                          PyObject *callback,
                                          PyObject *extra_args,
index 86da07f27183ccb9054b86b4aa3d83b6e158fba3..f3f0c81ecbf17a7956fe9b7ea95647f983a6e702 100644 (file)
--- a/gi/pygi.h
+++ b/gi/pygi.h
@@ -82,6 +82,7 @@ struct PyGI_API {
                                 GParamSpec *pspec,
                                 PyObject *value);
     GClosure * (*signal_closure_new) (PyGObject *instance,
+                                      GType g_type,
                                       const gchar *sig_name,
                                       PyObject *callback,
                                       PyObject *extra_args,
@@ -101,11 +102,7 @@ _pygi_import (void)
     if (PyGI_API != NULL) {
         return 1;
     }
-#if PY_VERSION_HEX >= 0x03000000
     PyGI_API = (struct PyGI_API*) PyCapsule_Import("gi._API", FALSE);
-#else
-    PyGI_API = (struct PyGI_API*) PyCObject_Import("gi", "_API");
-#endif
     if (PyGI_API == NULL) {
         return -1;
     }
@@ -145,6 +142,7 @@ pygi_set_property_value (PyGObject *instance,
 
 static inline GClosure *
 pygi_signal_closure_new (PyGObject *instance,
+                         GType g_type,
                          const gchar *sig_name,
                          PyObject *callback,
                          PyObject *extra_args,
@@ -153,7 +151,7 @@ pygi_signal_closure_new (PyGObject *instance,
     if (_pygi_import() < 0) {
         return NULL;
     }
-    return PyGI_API->signal_closure_new(instance, sig_name, callback, extra_args, swap_data);
+    return PyGI_API->signal_closure_new(instance, g_type, sig_name, callback, extra_args, swap_data);
 }
 
 static inline PyObject *
index 6f3c096f19c01a9fa888f777e87593071e354d9c..6134f6b3196248ddff39fc1911415c5e1d7a7dd0 100644 (file)
@@ -208,6 +208,7 @@ PYTHON_LIBS = @PYTHON_LIBS@
 PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
index 5bf200c81e1ede0aad969b8d008a79f99e1cdff1..95ae809a7571ebdd527147cab34ae1ad4eef283e 100644 (file)
@@ -48,12 +48,8 @@ if test "x$PYTHON_INCLUDES" = x; then
   if test -x "$PYTHON_CONFIG"; then
     PYTHON_INCLUDES=`$PYTHON_CONFIG --includes 2>/dev/null`
   else
-    py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`
-    py_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`
-    PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
-    if test "$py_prefix" != "$py_exec_prefix"; then
-      PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
-    fi
+    PYTHON_INCLUDES=`$PYTHON -c "import distutils.sysconfig, sys; sys.stdout.write(distutils.sysconfig.get_python_inc(True))"`
+    PYTHON_INCLUDES="-I$PYTHON_INCLUDES"
   fi
 fi
 AC_SUBST(PYTHON_INCLUDES)
@@ -72,10 +68,10 @@ dnl a macro to check for ability to embed python
 dnl  AM_CHECK_PYTHON_LIBS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
 dnl function also defines PYTHON_LIBS
 AC_DEFUN([AM_CHECK_PYTHON_LIBS],
-[AC_REQUIRE([AM_CHECK_PYTHON_HEADERS])
+[AC_REQUIRE([AM_PATH_PYTHON])
 AC_MSG_CHECKING(for libraries required to embed python)
 dnl deduce PYTHON_LIBS
-py_exec_prefix=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
+py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`
 if test "x$PYTHON_LIBS" = x; then
        PYTHON_LIBS="-L${py_prefix}/lib -lpython${PYTHON_VERSION}"
 fi
@@ -146,7 +142,7 @@ AC_DEFUN([JD_PATH_PYTHON],
   dnl Find a Python interpreter.  Python versions prior to 2.0 are not
   dnl supported
   m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
-                    [python3 python3.3 python3.2 python3.1 python2 python2.7 python2.6 python])
+                    [python3 python3.3 python3.2 python3.1 python2 python2.7 python])
 
   m4_if([$1],[],[
     dnl No version check is needed.
index c5887f87807cfcab5837ae6cc3cef49eb20c2e3d..43af6621dceb5587461ae8a7ac580fa31d8a5247 100755 (executable)
@@ -17,6 +17,7 @@ for f in $FILES_TO_CONVERT; do
 \
     -pe "s/import pygtk/import gi/g;" \
     -pe "s/pygtk.require\('2.0'\)/gi.require_version\('Gtk', '3.0'\)/g;" \
+    -pe "s/pygtk.require\(\"2.0\"\)/gi.require_version\(\"Gtk\", \"3.0\"\)/g;" \
     -pe "s/import gtk\n/from gi.repository import Gtk\n/g;" \
     -pe "s/(?<!\.)gtk\./Gtk\./g;" \
     -pe "s/Gtk.ACCEL_/Gtk.AccelFlags./g;" \
@@ -46,6 +47,8 @@ for f in $FILES_TO_CONVERT; do
     -pe "s/Gtk.ORIENTATION_/Gtk.Orientation./g;" \
     -pe "s/Gtk.POLICY_/Gtk.PolicyType./g;" \
     -pe "s/Gtk.POS_/Gtk.PositionType./g;" \
+    -pe "s/Gtk.RECENT_FILTER_/Gtk.RecentFilterFlags./g;" \
+    -pe "s/Gtk.RECENT_SORT_/Gtk.RecentSortType./g;" \
     -pe "s/Gtk.RELIEF_/Gtk.ReliefStyle./g;" \
     -pe "s/Gtk.RESPONSE_/Gtk.ResponseType./g;" \
     -pe "s/Gtk.SELECTION_/Gtk.SelectionMode./g;" \
@@ -59,6 +62,8 @@ for f in $FILES_TO_CONVERT; do
     -pe "s/Gtk.TEXT_DIR_/Gtk.TextDirection./g;" \
     -pe "s/Gtk.TEXT_SEARCH_/Gtk.TextSearchFlags./g;" \
     -pe "s/Gtk.TEXT_WINDOW_/Gtk.TextWindowType./g;" \
+    -pe "s/Gtk.TOOLBAR_/Gtk.ToolbarStyle./g;" \
+    -pe "s/Gtk.TREE_MODEL_/Gtk.TreeModelFlags./g;" \
     -pe "s/Gtk.TREE_VIEW_COLUMN_/Gtk.TreeViewColumnSizing./g;" \
     -pe "s/Gtk.TREE_VIEW_DROP_/Gtk.TreeViewDropPosition./g;" \
     -pe "s/Gtk.TRUE/True/g;" \
@@ -70,11 +75,12 @@ for f in $FILES_TO_CONVERT; do
     -pe "s/Gtk.accel_map_/Gtk.AccelMap./g;" \
     -pe "s/Gtk.settings_get_/Gtk.Settings.get_/g;" \
     -pe "s/Gtk.icon_theme_get_default/Gtk.IconTheme.get_default/g;" \
+    -pe "s/Gtk.recent_manager_get_default/Gtk.RecentManager.get_default/g;" \
     -pe "s/Gtk.image_new_from_stock/Gtk.Image.new_from_stock/g;" \
     -pe "s/Gtk.image_new_from_icon_name/Gtk.Image.new_from_icon_name/g;" \
     -pe "s/Gtk.window_set_default_icon_name/Gtk.Window.set_default_icon_name/g; " \
     -pe "s/Gtk.combo_box_new_text/Gtk.ComboBoxText/g;" \
-    -pe "s/Gtk.keysyms./Gdk.KEY_/g;" \
+    -pe "s/Gtk.keysyms\./Gdk.KEY_/g;" \
     -pe "s/set_flags\(Gtk.CAN_DEFAULT\)/set_can_default\(True\)/g;" \
     -pe "s/.flags\(\) & Gtk.MAPPED/.get_mapped\(\)/g;" \
     -pe "s/.flags\(\) & Gtk.REALIZED/.get_realized\(\)/g;" \
@@ -189,6 +195,8 @@ for f in $FILES_TO_CONVERT; do
 \
     -pe "s/import gio\n/from gi.repository import Gio\n/g;" \
     -pe "s/gio\./Gio\./g;" \
+    -pe "s/Gio\.File\(uri=/Gio\.File\.new_for_uri\(/g;" \
+    -pe "s/Gio\.File\(path=/Gio\.File\.new_for_path\(/g;" \
     -pe "s/Gio.FILE_COPY_/Gio.FileCopyFlags./g;" \
     -pe "s/Gio.FILE_CREATE_/Gio.FileCreateFlags./g;" \
     -pe "s/Gio.FILE_MONITOR_EVENT_/Gio.FileMonitorEvent./g;" \
@@ -344,6 +352,23 @@ for f in $FILES_TO_CONVERT; do
     -pe "s/Clutter.RELEASE_MASK/Clutter.ModifierType.RELEASE_MASK/g;" \
     -pe "s/Clutter.SHIFT_MASK/Clutter.ModifierType.SHIFT_MASK/g;" \
     -pe "s/Clutter.SUPER_MASK/Clutter.ModifierType.SUPER_MASK/g;" \
+\
+    -pe "s/import gst\n/from gi.repository import Gst\n/g;" \
+    -pe "s/(?<!\.)gst\./Gst\./g;" \
+    -pe "s/Gst.element_factory_find/Gst.ElementFactory.find/g;" \
+    -pe "s/Gst.element_factory_make/Gst.ElementFactory.make/g;" \
+    -pe "s/Gst.caps_from_string/Gst.Caps.from_string/g;" \
+    -pe "s/Gst.STATE_CHANGE_/Gst.StateChangeReturn./g;" \
+    -pe "s/Gst.STATE_/Gst.State./g;" \
+    -pe "s/Gst.MESSAGE_/Gst.MessageType./g;" \
+    -pe "s/Gst.FORMAT_/Gst.Format./g;" \
+    -pe "s/Gst.SEEK_FLAG_/Gst.SeekFlags./g;" \
+    -pe "s/Gst.SEEK_TYPE_/Gst.SeekType./g;" \
+    -pe "s/Gst.LEVEL_/Gst.DebugLevel./g;" \
+    -pe "s/Gst.URI_/Gst.URIType./g;" \
+    -pe "s/Gst.element_make_from_uri/Gst.Element.make_from_uri/g;" \
+    -pe "s/Gst.event_new_seek/Gst.Event.new_seek/g;" \
+    -pe "s/Gst.GhostPad\(/Gst.GhostPad.new\(/g;" \
     $f
 done
 
index 990e5e871a67d4af41e26d33b2664bf4089b3155..255c924a296abc883c33be41556bea8397de2d20 100644 (file)
@@ -208,6 +208,7 @@ PYTHON_LIBS = @PYTHON_LIBS@
 PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
index 140fa2bc57e3d089948272cc43f4ece3e4b691c1..7062aa79d5ce8a91510f4bdda61b6197b0895129 100644 (file)
@@ -1,5 +1,5 @@
 CLEANFILES =
-noinst_LTLIBRARIES = libgimarshallingtests.la
+check_LTLIBRARIES = libgimarshallingtests.la
 test_typelibs = GIMarshallingTests-1.0.typelib
 
 nodist_libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c $(GI_DATADIR)/tests/gimarshallingtests.h
@@ -23,7 +23,7 @@ GIMarshallingTests-1.0.typelib: GIMarshallingTests-1.0.gir Makefile
 
 # regress.c needs cairo
 if ENABLE_CAIRO
-noinst_LTLIBRARIES += libregress.la
+check_LTLIBRARIES += libregress.la
 test_typelibs += Regress-1.0.typelib
 nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
 libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS)
@@ -52,7 +52,7 @@ gschemas.compiled: org.gnome.test.gschema.xml
 
 CLEANFILES += Regress-1.0.gir Regress-1.0.typelib GIMarshallingTests-1.0.gir GIMarshallingTests-1.0.typelib gschemas.compiled
 
-noinst_LTLIBRARIES += testhelper.la
+check_LTLIBRARIES += testhelper.la
 
 testhelper_la_CFLAGS = -I$(top_srcdir)/gi/_gobject -I$(top_srcdir)/gi/_glib $(PYTHON_INCLUDES) $(GLIB_CFLAGS)
 testhelper_la_LDFLAGS = -module -avoid-version
@@ -72,7 +72,7 @@ testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES)
        test -L $@ || $(LN_S) .libs/$@ $@
 
 
-all: $(LTLIBRARIES:.la=.so)
+all: $(check_LTLIBRARIES:.la=.so)
 
 EXTRA_DIST = \
        compathelper.py \
@@ -116,7 +116,7 @@ EXTRA_DIST = \
        $(NULL)
 
 clean-local:
-       rm -f $(LTLIBRARIES:.la=.so) file.txt~
+       rm -f $(check_LTLIBRARIES:.la=.so) file.txt~
 
 DBUS_LAUNCH=$(shell which dbus-launch)
 RUN_TESTS_ENV_VARS= \
@@ -131,7 +131,7 @@ RUN_TESTS_ENV_VARS= \
 
 # pygtkcompat tests need to be run in a separate process as they
 # clobber global name space
-check-local: $(LTLIBRARIES:.la=.so) $(test_typelibs) gschemas.compiled
+check-local: $(check_LTLIBRARIES:.la=.so) $(test_typelibs) gschemas.compiled
        @echo "  CHECK  Pyflakes"
        @if type pyflakes >/dev/null 2>&1; then pyflakes $(top_srcdir); else echo "skipped, pyflakes not installed"; fi
        @if test -z "$$SKIP_PEP8"; then \
index 6f3cd5e189c999fef119fc7f40c3abdc9c485f1c..77dbc14ea6c775d4f1cc4f02bf6def5cbc17c079 100644 (file)
@@ -14,7 +14,6 @@
 # PARTICULAR PURPOSE.
 
 @SET_MAKE@
-
 VPATH = @srcdir@
 am__make_dryrun = \
   { \
@@ -69,7 +68,6 @@ mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
 libgimarshallingtests_la_LIBADD =
 nodist_libgimarshallingtests_la_OBJECTS =  \
        libgimarshallingtests_la-gimarshallingtests.lo
@@ -235,6 +233,7 @@ PYTHON_LIBS = @PYTHON_LIBS@
 PYTHON_LIB_LOC = @PYTHON_LIB_LOC@
 PYTHON_PLATFORM = @PYTHON_PLATFORM@
 PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_SO = @PYTHON_SO@
 PYTHON_VERSION = @PYTHON_VERSION@
 RANLIB = @RANLIB@
 SED = @SED@
@@ -303,7 +302,7 @@ top_srcdir = @top_srcdir@
 CLEANFILES = Regress-1.0.gir Regress-1.0.typelib \
        GIMarshallingTests-1.0.gir GIMarshallingTests-1.0.typelib \
        gschemas.compiled
-noinst_LTLIBRARIES = libgimarshallingtests.la $(am__append_1) \
+check_LTLIBRARIES = libgimarshallingtests.la $(am__append_1) \
        testhelper.la
 test_typelibs = GIMarshallingTests-1.0.typelib $(am__append_2)
 nodist_libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c $(GI_DATADIR)/tests/gimarshallingtests.h
@@ -408,9 +407,9 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-clean-noinstLTLIBRARIES:
-       -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-       @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+clean-checkLTLIBRARIES:
+       -test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES)
+       @list='$(check_LTLIBRARIES)'; for p in $$list; do \
          dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
          test "$$dir" != "$$p" || dir=.; \
          echo "rm -f \"$${dir}/so_locations\""; \
@@ -584,9 +583,10 @@ distdir: $(DISTFILES)
          fi; \
        done
 check-am: all-am
+       $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES)
        $(MAKE) $(AM_MAKEFLAGS) check-local
 check: check-am
-all-am: Makefile $(LTLIBRARIES)
+all-am: Makefile
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -621,8 +621,8 @@ maintainer-clean-generic:
        @echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-local \
-       clean-noinstLTLIBRARIES mostlyclean-am
+clean-am: clean-checkLTLIBRARIES clean-generic clean-libtool \
+       clean-local mostlyclean-am
 
 distclean: distclean-am
        -rm -rf ./$(DEPDIR)
@@ -693,15 +693,15 @@ uninstall-am:
 .MAKE: check-am install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am check-local clean \
-       clean-generic clean-libtool clean-local \
-       clean-noinstLTLIBRARIES ctags distclean distclean-compile \
-       distclean-generic distclean-libtool distclean-tags distdir dvi \
-       dvi-am html html-am info info-am install install-am \
-       install-data install-data-am install-dvi install-dvi-am \
-       install-exec install-exec-am install-html install-html-am \
-       install-info install-info-am install-man install-pdf \
-       install-pdf-am install-ps install-ps-am install-strip \
-       installcheck installcheck-am installdirs maintainer-clean \
+       clean-checkLTLIBRARIES clean-generic clean-libtool clean-local \
+       ctags distclean distclean-compile distclean-generic \
+       distclean-libtool distclean-tags distdir dvi dvi-am html \
+       html-am info info-am install install-am install-data \
+       install-data-am install-dvi install-dvi-am install-exec \
+       install-exec-am install-html install-html-am install-info \
+       install-info-am install-man install-pdf install-pdf-am \
+       install-ps install-ps-am install-strip installcheck \
+       installcheck-am installdirs maintainer-clean \
        maintainer-clean-generic mostlyclean mostlyclean-compile \
        mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
        tags uninstall uninstall-am
@@ -747,14 +747,14 @@ testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES)
 .la.so:
        test -L $@ || $(LN_S) .libs/$@ $@
 
-all: $(LTLIBRARIES:.la=.so)
+all: $(check_LTLIBRARIES:.la=.so)
 
 clean-local:
-       rm -f $(LTLIBRARIES:.la=.so) file.txt~
+       rm -f $(check_LTLIBRARIES:.la=.so) file.txt~
 
 # pygtkcompat tests need to be run in a separate process as they
 # clobber global name space
-check-local: $(LTLIBRARIES:.la=.so) $(test_typelibs) gschemas.compiled
+check-local: $(check_LTLIBRARIES:.la=.so) $(test_typelibs) gschemas.compiled
        @echo "  CHECK  Pyflakes"
        @if type pyflakes >/dev/null 2>&1; then pyflakes $(top_srcdir); else echo "skipped, pyflakes not installed"; fi
        @if test -z "$$SKIP_PEP8"; then \
index d3a4f4775a1b3c17d6d8a789ba605a063c0665f2..6085ff95400dd3a92e2d62a36d9b947ddb7bf8aa 100755 (executable)
@@ -7,50 +7,7 @@ import sys
 
 import unittest
 
-# provide missing unittest decorators and API for python 2.6; these decorators
-# do not actually work, just avoid the syntax failure
-if sys.version_info[:2] == (2, 6):
-    def skipUnless(condition, reason):
-        if not condition:
-            sys.stderr.write('[expected failure] ')
-        return lambda obj: obj
-
-    unittest.skipUnless = skipUnless
-    unittest.expectedFailure = lambda obj: obj
-
-    def skipIf(condition, reason):
-        if condition:
-            sys.stderr.write('[expected failure] ')
-        return lambda obj: obj
-
-    unittest.skipIf = skipIf
-
-    def assertGreater(self, a, b, msg=None):
-        if not a > b:
-            self.fail('%s not greater than %s' % (repr(a), repr(b)))
-
-    def assertGreaterEqual(self, a, b, msg=None):
-        if not a >= b:
-            self.fail('%s not greater than or equal to %s' % (repr(a), repr(b)))
-
-    def assertLess(self, a, b, msg=None):
-        if not a < b:
-            self.fail('%s not less than %s' % (repr(a), repr(b)))
-
-    def assertLessEqual(self, a, b, msg=None):
-        if not a <= b:
-            self.fail('%s not less than or equal to %s' % (repr(a), repr(b)))
-
-    def assertIsInstance(self, obj, cls, msg=None):
-        if not isinstance(obj, cls):
-            self.fail('%s is not an instance of %r' % (repr(obj), cls))
-
-    unittest.TestCase.assertGreaterEqual = assertGreaterEqual
-    unittest.TestCase.assertGreater = assertGreater
-    unittest.TestCase.assertLessEqual = assertLessEqual
-    unittest.TestCase.assertLess = assertLess
-    unittest.TestCase.assertIsInstance = assertIsInstance
-
+# this was renamed in Python 3, provide backwards compatible name
 if sys.version_info[:2] == (2, 7):
     unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
 
index 3c820d71c44460df2031d7dbe5e3ebaafbf82067..87b3d2bd86527d54ccdf2b48cc74dbf7fe65d435 100644 (file)
@@ -505,7 +505,8 @@ class TestEverything(unittest.TestCase):
         glist = GLib.List()
         raw = RawGList.from_wrapped(glist)
 
-        self.assertEqual(glist.data, None)
+        # Note that pointer fields use 0 for NULL in PyGObject and None in ctypes
+        self.assertEqual(glist.data, 0)
         self.assertEqual(raw.contents.data, None)
 
         glist.data = 123
@@ -513,7 +514,7 @@ class TestEverything(unittest.TestCase):
         self.assertEqual(raw.contents.data, 123)
 
         glist.data = None
-        self.assertEqual(glist.data, None)
+        self.assertEqual(glist.data, 0)
         self.assertEqual(raw.contents.data, None)
 
         # Setting to anything other than an int should raise
@@ -1139,6 +1140,39 @@ class TestSignals(unittest.TestCase):
         obj.emit_sig_with_obj()
         self.assertTrue(obj.called)
 
+    def test_connect_after(self):
+        obj = Everything.TestObj()
+
+        def callback(obj, obj_param):
+            obj.called = True
+
+        obj.called = False
+        obj.connect_after('sig-with-obj', callback)
+        obj.emit_sig_with_obj()
+        self.assertTrue(obj.called)
+
+    def test_connect_object(self):
+        obj = Everything.TestObj()
+
+        def callback(obj, obj_param):
+            obj.called = True
+
+        obj.called = False
+        obj.connect_object('sig-with-obj', callback, obj)
+        obj.emit_sig_with_obj()
+        self.assertTrue(obj.called)
+
+    def test_connect_object_after(self):
+        obj = Everything.TestObj()
+
+        def callback(obj, obj_param):
+            obj.called = True
+
+        obj.called = False
+        obj.connect_object_after('sig-with-obj', callback, obj)
+        obj.emit_sig_with_obj()
+        self.assertTrue(obj.called)
+
     def test_int64_param_from_py(self):
         obj = Everything.TestObj()
 
index 26715885bf1c4ec0741d2bd9cc8054de0e3e3fe4..2f5e8cf478e53892dd99f5eeacf4f8d084ecb323 100644 (file)
@@ -813,8 +813,6 @@ class TestArray(unittest.TestCase):
 
         GIMarshallingTests.array_struct_in([struct1, struct2, struct3])
 
-    @unittest.skipUnless(hasattr(GIMarshallingTests, 'array_struct_value_in'),
-                         'too old gobject-introspection')
     def test_array_boxed_struct_value_in(self):
         struct1 = GIMarshallingTests.BoxedStruct()
         struct1.long_ = 1
@@ -970,8 +968,6 @@ class TestGArray(unittest.TestCase):
     def test_garray_utf8_full_out(self):
         self.assertEqual(['0', '1', '2'], GIMarshallingTests.garray_utf8_full_out())
 
-    @unittest.skipUnless(hasattr(GIMarshallingTests, 'garray_utf8_full_out_caller_allocated'),
-                         'too old gobject-introspection')
     def test_garray_utf8_full_out_caller_allocated(self):
         self.assertEqual(['0', '1', '2'], GIMarshallingTests.garray_utf8_full_out_caller_allocated())
 
@@ -1029,15 +1025,11 @@ class TestGBytes(unittest.TestCase):
         self.assertEqual(3, b.get_size())
         self.assertEqual(b'\x00\x01\xFF', b.get_data())
 
-    @unittest.skipUnless(hasattr(GIMarshallingTests, 'gbytes_full_return'),
-                         'too old gobject-introspection')
     def test_gbytes_full_return(self):
         b = GIMarshallingTests.gbytes_full_return()
         self.assertEqual(4, b.get_size())
         self.assertEqual(b'\x00\x31\xFF\x33', b.get_data())
 
-    @unittest.skipUnless(hasattr(GIMarshallingTests, 'gbytes_full_return'),
-                         'too old gobject-introspection')
     def test_gbytes_none_in(self):
         b = GIMarshallingTests.gbytes_full_return()
         GIMarshallingTests.gbytes_none_in(b)
@@ -1497,8 +1489,6 @@ class TestEnum(unittest.TestCase):
                           GIMarshallingTests.NoTypeFlags.__gtype__)
 
 
-@unittest.skipUnless(hasattr(GIMarshallingTests.Object, 'vfunc_return_enum'),
-                     'GIMarshallingTests too old')
 class TestEnumVFuncResults(unittest.TestCase):
     class EnumTester(GIMarshallingTests.Object):
         def do_vfunc_return_enum(self):
@@ -1757,8 +1747,6 @@ class TestStructure(unittest.TestCase):
 
         del struct
 
-    @unittest.skipUnless(hasattr(GIMarshallingTests.BoxedStruct, 'string_'),
-                         'too old gobject-introspection')
     def test_boxed_struct(self):
         self.assertTrue(issubclass(GIMarshallingTests.BoxedStruct, GObject.GBoxed))
 
@@ -1771,8 +1759,6 @@ class TestStructure(unittest.TestCase):
 
         del struct
 
-    @unittest.skipUnless(hasattr(GIMarshallingTests.BoxedStruct, 'string_'),
-                         'too old gobject-introspection')
     def test_boxed_struct_new(self):
         struct = GIMarshallingTests.BoxedStruct.new()
         self.assertTrue(isinstance(struct, GIMarshallingTests.BoxedStruct))
@@ -1781,8 +1767,6 @@ class TestStructure(unittest.TestCase):
 
         del struct
 
-    @unittest.skipUnless(hasattr(GIMarshallingTests.BoxedStruct, 'string_'),
-                         'too old gobject-introspection')
     def test_boxed_struct_copy(self):
         struct = GIMarshallingTests.BoxedStruct()
         struct.long_ = 42
@@ -1796,8 +1780,6 @@ class TestStructure(unittest.TestCase):
         del new_struct
         del struct
 
-    @unittest.skipUnless(hasattr(GIMarshallingTests.BoxedStruct, 'string_'),
-                         'too old gobject-introspection')
     def test_boxed_struct_return(self):
         struct = GIMarshallingTests.boxed_struct_returnv()
 
@@ -2511,8 +2493,6 @@ class TestGError(unittest.TestCase):
 
 class TestParamSpec(unittest.TestCase):
     # https://bugzilla.gnome.org/show_bug.cgi?id=682355
-    @unittest.skipUnless(hasattr(GIMarshallingTests, 'param_spec_in_bool'),
-                         'too old gobject-introspection')
     @unittest.expectedFailure
     def test_param_spec_in_bool(self):
         ps = GObject.param_spec_boolean('mybool', 'test-bool', 'boolblurb',
@@ -2755,8 +2735,6 @@ class TestPropertiesObject(unittest.TestCase):
         obj = GIMarshallingTests.PropertiesObject(some_boxed_struct=struct1)
         self.assertEqual(obj.props.some_boxed_struct.long_, 1)
 
-    @unittest.skipUnless(hasattr(GIMarshallingTests.PropertiesObject, 'some_boxed_glist'),
-                         'too old gobject-introspection')
     def test_boxed_glist(self):
         self.assertEqual(self.obj.props.some_boxed_glist, [])
 
@@ -2776,8 +2754,6 @@ class TestPropertiesObject(unittest.TestCase):
         obj = GIMarshallingTests.PropertiesObject(some_boxed_glist=l)
         self.assertEqual(obj.props.some_boxed_glist, l)
 
-    @unittest.skipUnless(hasattr(GIMarshallingTests.PropertiesObject, 'some_variant'),
-                         'too old gobject-introspection')
     def test_variant(self):
         self.assertEqual(self.obj.props.some_variant, None)
 
@@ -2891,6 +2867,10 @@ class TestObjectInfo(unittest.TestCase):
         info = repo.find_by_name('GObject', 'Object')
         self.assertFalse(info.get_abstract())
 
+    def test_get_class_struct(self):
+        self.assertEqual(GObject.Object.__info__.get_class_struct(),
+                         GObject.ObjectClass.__info__)
+
 
 class TestSignatureArgs(unittest.TestCase):
     def test_split_args_multi_out(self):
index ec4cb44b6ace8254b23fd55bc5329952d24b75ca..64422bd7da736fab074f4843c1050157868b2b47 100644 (file)
@@ -28,7 +28,6 @@ class TestGObjectAPI(unittest.TestCase):
         # The pytype wrapper should hold the outer most Object class from overrides.
         self.assertEqual(GObject.TYPE_OBJECT.pytype, GObject.Object)
 
-    @unittest.skipIf(sys.version_info[:2] < (2, 7), 'Python 2.7 is required')
     def test_gobject_unsupported_overrides(self):
         obj = GObject.Object()
 
index 2432b441dab12579c12f213388786694e170c185..624ed9d08c9a04a9e3d77b626a267d79713fa441 100644 (file)
@@ -87,9 +87,6 @@ class VFuncsBase(GIMarshallingTests.Object):
         self.in_object_is_floating = obj.is_floating()
 
 
-@unittest.skipUnless(hasattr(VFuncsBase, 'get_ref_info_for_vfunc_return_object_transfer_none') and
-                     hasattr(VFuncsBase, 'get_ref_info_for_vfunc_out_object_transfer_none'),
-                     'too old gobject-introspection')
 class TestVFuncsWithObjectArg(unittest.TestCase):
     # Basic set of tests which work on non-floating objects which python does
     # not keep an additional reference of.
@@ -200,9 +197,6 @@ class TestVFuncsWithObjectArg(unittest.TestCase):
         self.assertTrue(vfuncs.object_ref() is None)
 
 
-@unittest.skipUnless(hasattr(VFuncsBase, 'get_ref_info_for_vfunc_return_object_transfer_none') and
-                     hasattr(VFuncsBase, 'get_ref_info_for_vfunc_out_object_transfer_none'),
-                     'too old gobject-introspection')
 class TestVFuncsWithFloatingArg(unittest.TestCase):
     # All tests here work with a floating object by using InitiallyUnowned as the argument
 
@@ -290,9 +284,6 @@ class TestVFuncsWithFloatingArg(unittest.TestCase):
         self.assertTrue(vfuncs.object_ref() is None)
 
 
-@unittest.skipUnless(hasattr(VFuncsBase, 'get_ref_info_for_vfunc_return_object_transfer_none') and
-                     hasattr(VFuncsBase, 'get_ref_info_for_vfunc_out_object_transfer_none'),
-                     'too old gobject-introspection')
 class TestVFuncsWithHeldObjectArg(unittest.TestCase):
     # Same tests as TestVFuncsWithObjectArg except we hold
     # onto the python object reference in all cases.
@@ -422,9 +413,6 @@ class TestVFuncsWithHeldObjectArg(unittest.TestCase):
         self.assertTrue(held_object_ref() is None)
 
 
-@unittest.skipUnless(hasattr(VFuncsBase, 'get_ref_info_for_vfunc_return_object_transfer_none') and
-                     hasattr(VFuncsBase, 'get_ref_info_for_vfunc_out_object_transfer_none'),
-                     'too old gobject-introspection')
 class TestVFuncsWithHeldFloatingArg(unittest.TestCase):
     # Tests for a floating object which we hold a reference to the python wrapper
     # on the VFuncs test class.
@@ -547,8 +535,6 @@ class TestVFuncsWithHeldFloatingArg(unittest.TestCase):
         self.assertTrue(held_object_ref() is None)
 
 
-@unittest.skipUnless(hasattr(GIMarshallingTests.PropertiesObject.props, 'some_object'),
-                     'too old gobject-introspection')
 class TestPropertyHoldingObject(unittest.TestCase):
     def test_props_getter_holding_object_ref_count(self):
         holder = GIMarshallingTests.PropertiesObject()
index 51f4f6adbb5662ff2eaedc59828ef5be1fda1533..42d4de92417a115c0df6c466c16b401dd7ddf0a9 100644 (file)
@@ -30,3 +30,8 @@ class TestPango(unittest.TestCase):
 
         layout.set_markup("Foobar")
         self.assertEqual(layout.get_text(), "Foobar")
+
+    def test_break_keyword_escape(self):
+        # https://bugzilla.gnome.org/show_bug.cgi?id=697363
+        self.assertTrue(hasattr(Pango, 'break_'))
+        self.assertTrue(Pango.break_ is not None)
index 776ad7aca5e7ba48b112f89b4b744f7a19663b87..80f2986b3f7e92008be1b99fb69579d8d6b7d19e 100644 (file)
@@ -925,12 +925,10 @@ class TestPython3Signals(unittest.TestCase):
 
 
 class TestSignalModuleLevelFunctions(unittest.TestCase):
-    @unittest.skipIf(sys.version_info < (2, 7), 'Requires Python >= 2.7')
     def test_signal_list_ids_with_invalid_type(self):
         with self.assertRaisesRegex(TypeError, 'type must be instantiable or an interface.*'):
             GObject.signal_list_ids(GObject.TYPE_INVALID)
 
-    @unittest.skipIf(sys.version_info < (2, 7), 'Requires Python >= 2.7')
     def test_signal_list_ids(self):
         with self.assertRaisesRegex(TypeError, 'type must be instantiable or an interface.*'):
             GObject.signal_list_ids(GObject.TYPE_INT)
@@ -942,12 +940,10 @@ class TestSignalModuleLevelFunctions(unittest.TestCase):
         # There is no signal 0 in gobject
         self.assertEqual(GObject.signal_name(0), None)
 
-    @unittest.skipIf(sys.version_info < (2, 7), 'Requires Python >= 2.7')
     def test_signal_lookup_with_invalid_type(self):
         with self.assertRaisesRegex(TypeError, 'type must be instantiable or an interface.*'):
             GObject.signal_lookup('NOT_A_SIGNAL_NAME', GObject.TYPE_INVALID)
 
-    @unittest.skipIf(sys.version_info < (2, 7), 'Requires Python >= 2.7')
     def test_signal_lookup(self):
         ids = GObject.signal_list_ids(C)
         self.assertEqual(ids[0], GObject.signal_lookup('my_signal', C))