gi/pygi-info.c: Avoid C99-style variable declaration

https://bugzilla.gnome.org/show_bug.cgi?id=702786
pygtkcompat: Fix for missing methods on Windows

Deal with non-existing Gtk.Clipboard.get() and
GdkPixbuf.Pixbuf.new_from_file_at_scale() methods.

https://bugzilla.gnome.org/show_bug.cgi?id=702787
Add support for properties of type GInterface

Add support for G_TYPE_INTERFACE/GInterface to switch
statement which handles G_TYPE_OBJECT based properties.

Signed-off-by: Simon Feltman <sfeltman@src.gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=703456
Don't use doctest syntax in docstrings for examples

These are not actual doctests, so don't use the >>> syntax there. Just indent
them.

This fixes pyflakes 0.7 failures.

https://bugzilla.gnome.org/show_bug.cgi?id=701009
Clear return value of closures to zero when an exception occures

For return types other than void, set the ffi closure return argument
to 0 when a Python exception occures. This a good default in general
but also has the side affect of fixing failing idle callbacks
by causing them to be removed from main loops (after their stack
is printed).

https://bugzilla.gnome.org/show_bug.cgi?id=702552
tests: Add test for pass-by-reference GValue

https://bugzilla.gnome.org/show_bug.cgi?id=701058
Re-add support for passing GValue's by reference

Fix special casing when marshaling from a Python held GValue
to a GValue argument intended for a function call.
The re-factoring of GValue marshaling in commit #9e47afe459df942d9f
broke this by always making a copy of the GValue. This removed the
ability to retrieve values with functions like
gtk_style_context_get_style_property.

https://bugzilla.gnome.org/show_bug.cgi?id=701058
GTK overrides: Make connect_signals handle tuple

This is used for passing extra arguments to callbacks during
signal emission in the form of:
builder.connect_signals({'on_clicked': (on_clicked, arg1, arg2)})

Co-Authored-By: Simon Feltman <sfeltman@src.gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=693994
Add marshalling of GI_TYPE_TAG_VOID held in a GValue to int

Replace assertion for this case with a simple marshalling of the
pointer value to a Python int. While not particularly useful
this allows some callbacks in WebKit to function without causing
a segfault.

https://bugzilla.gnome.org/show_bug.cgi?id=694233
testhelper: Fix import requirement for GObject

Replace the importing of gi._gobject._gobject with gi.repository.GObject
in tests/testhelpermodule.c

The testhelper module was only importing the static bindings
(gi._gobject._gobject) and not the overrides (gi.repository.GObject).
This was causing some tests to fail when test_thread was the first
test to run in the suite due to it registering new types based on
PyGObject_Type.

https://bugzilla.gnome.org/show_bug.cgi?id=703647
Add GIL safety to pyobject_copy for copying boxed PyObjects

https://bugzilla.gnome.org/show_bug.cgi?id=688081
tests: Add tests for MRO override

Add tests for the MRO override to prevent against unintended
behaviour changes.

https://bugzilla.gnome.org/show_bug.cgi?id=703829
Speed up MRO calculation

Optimize gi.type.mro() with the following observations and tricks:

1. Python prepares all the base classes before trying to calculate the
   MRO of the current one (it first needs to populate __bases__, for
   example). So we can assume that the base class MRO is already available
   in __mro__ and this will have been previously calculated (by us, in the
   case of gi classes). This avoids repeating a lot of MRO-calculating work,
   and also avoids (re)calculating MROs for inheritance chains that don't
   have any gi classes in them anyway.

2. With that simplification in place, we can avoid recursion, which is not
   all that great in Python...

3. ...except in the uncommon case of a Python2 old-style classes, where
   __mro__ is not available. There doesn't seem to be any existing
   function to calculate or read MRO of old-style python classes, so just
   keep doing as before: calculate the C3 MRO of the old-style class via
   recursion. That behaviour is not really correct, and the recursion is
   not desirable, so we print a warning here.

This makes the "hello world" Sugar app start up approximately 0.5 seconds
faster on XO-1.5.

https://bugzilla.gnome.org/show_bug.cgi?id=703829
Unref interface info when fetching enums or flags

When calling g_type_info_get_interface, the resulting interface should
be dereferenced by calling g_base_info_unref.

https://bugzilla.gnome.org/show_bug.cgi?id=703960
Always unref the GiTypeInfo when generating an argument cache

We were leaking a GiTypeInfo when handling child arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=703973
Replace usage of __import__ with importlib.import_module

https://bugzilla.gnome.org/show_bug.cgi?id=682320
Move PyGIDeprecationWarning to C for shared Python/C usage

https://bugzilla.gnome.org/show_bug.cgi?id=688081
Add deprecation warning for marshaling arbitrary objects as pointers

Add deprecation warning for marshaling arbitrary objects to/from void
pointers with the exception of integers, PyCapsules, and None.

https://bugzilla.gnome.org/show_bug.cgi?id=688081
Fix indentation for pyg_value_from_pyobject

https://bugzilla.gnome.org/show_bug.cgi?id=688081
Refactor pyg_value_from_pyobject into two functions

Break pyg_value_from_pyobject into two functions. One which keeps
Python exceptions queued (pyg_value_from_pyobject_with_error) and
one which clears them (pyg_value_from_pyobject). This allows for
re-use for code which want to keep the errors around

https://bugzilla.gnome.org/show_bug.cgi?id=688081