tests: Add failing tests for GObject sub-class doc-strings

Add tests for sub-class docstrings set with either doc-string
syntax and by setting the __doc__ attribute directly.

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

https://bugzilla.gnome.org/show_bug.cgi?id=731452
Don't mask GObject sub-class doc strings in meta-class

If a class has a __doc__ attribute explicitly set, always return it.
Only generate doc strings for classes coming from  gi.repository
or gi.overrides.

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=734926
tests: Add reference count test for signal connection arguments

Add tests for ensuring reference counts are what we expect for
connect() callback, user_data, and swap object (currently broken
due to bug 688064).

https://bugzilla.gnome.org/show_bug.cgi?id=727004
Fix memory leak with unboxed caller allocated structs

Take caller-allocates into account when wrapping unboxed structures.
This will free the allocated memory when the Python object is de-alloced.
Remove dead code for marshalling array lengths in the context of vfuncs

Remove usage of the args parameter from _pygi_argument_to_array. This is no
longer used because array marshalling for vfuncs is now handled by the cached
marshaller.

https://bugzilla.gnome.org/show_bug.cgi?id=688792
Refactor signal array length marshalling to support a length policy

Replace passing arrays of data to non-caching array marshallers with a policy
closure that can be customized depending on context. In the case of signals,
this is mostly scaffolding which will be replaced with caching marshallers.
However, it opens the legacy marshaller for usage with struct and object
array fields.

https://bugzilla.gnome.org/show_bug.cgi?id=688792
Use array lengths specified on struct fields

Add array length marshalling policy for struct fields. This fixes accessing
C array fields on structs which also specify a length field.

https://bugzilla.gnome.org/show_bug.cgi?id=688792
Replace GObject.signal_query with introspected version

Remove the static bindings for GObject.signal_query and replace with a
Python compatibility shim which utilizes the introspection exposed version
of the function.

https://bugzilla.gnome.org/show_bug.cgi?id=688792
Refactor boxed wrapper memory management strategy

Change pygi_boxed_new() to accept "copy_boxed" instead of "free_on_dealloc".
This changes memory management so the PyGIBoxed wrapper owns the boxed
pointer given to it. Use __del__ instead of dealloc for freeing the boxed
memory. This is needed for edge cases where objects like GSource can
trigger the finalized callback during de-alloc, resulting in the PyObjects
references counts being manipulated and triggering a re-entrant de-alloc.
Add hack to keep Gtk.TreeIter.do_iter_next/previous implementations working
which rely on pass-by-reference.
See also: https://bugzilla.gnome.org/show_bug.cgi?id=734465

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

https://bugzilla.gnome.org/show_bug.cgi?id=726999
Never dup data structures when marshaling from g_object_get_property()

Always use transfer-none with the results of g_object_get_property()
and assume g_value_unset() will cleanup the results. This gives us
control over memory of properties and limits property anotations to
value typing.

https://bugzilla.gnome.org/show_bug.cgi?id=726999
Never dup data structures when marshaling signal in arguments

Always assume transfer-none of GValue arguments to signal handlers.
A signal handler with arguments marked as transfer-full does not
make any sense, so assume they are always transfer-none.

https://bugzilla.gnome.org/show_bug.cgi?id=726999
Merge pygi_get_property_value and _pygi_argument_from_g_value

Merge duplicated GValue marshaling code which has diverged over time
(commits 3606eb20, ee62df4d, e14ebab6, 8cfd596c, 9f50fd21, 0d099bdb, and 216caf59).
Use _pygi_argument_to_array within pygi_get_property_value. This is needed
in the new code for supporting GI_TYPE_TAG_ARRAY and also fixes bug 669496.
Side effects of this change also include support for properties holding
G_TYPE_FLAGS and G_TYPE_PARAM.

https://bugzilla.gnome.org/show_bug.cgi?id=726999
Unify property getters

Consolidate duplicate logic into pygi_get_property_value().
Use the function for GObject.get_property(), GObject.get_properties(),
and GObject.props.
Remove overridden expected failures in TestCGetPropertyMethod which
now work due to the unification.

https://bugzilla.gnome.org/show_bug.cgi?id=733893
https://bugzilla.gnome.org/show_bug.cgi?id=726999
Break pyg_value_as_pyobject into two functions

Add pygi_value_to_py_basic_type() which is limited to handling basic
types that don't need introspection information when marshalling to Python.
Add pygi_value_to_py_structured_type() for marshalling of structured data
which can eventually accept GI type hints.

https://bugzilla.gnome.org/show_bug.cgi?id=726999
Fast path property access for basic types

Attempt marshalling with pygi_value_to_py_basic_type() prior to looking at
GI info. This gives a quick conversion for basic types like bools, ints, and
strings without having to go through GIArgument and GI conversions. This
gives approximately a 3x performance boost for accessing these types with
the unified GValue marshaller.

https://bugzilla.gnome.org/show_bug.cgi?id=726999
Don't use GI type for determining pointer extraction from GValues

Replace usage of g_type_is_a() with G_VALUE_HOLDS() when extracting
pointers from GValues being marshalled from properties and signals.
This fixes fallout from commit abdfb0f.
Fast path Python Property getter when accessing descriptor directly

Call the Python implemented fget() when a property is accessed directly
on a Python implemented GObject. This skips going through the GObject
machinery which ends up calling fget() and marshalling the results
through GValues.

https://bugzilla.gnome.org/show_bug.cgi?id=723872
Fast path Python Property getter when accessed through GObject interfaces

Break do_get_property() call into a re-usable function.
Call do_get_property() Python implementations instead of going through GObject
machinery for Python GObjects. This gives a performance boost for Python
GObject properties when accessed via. obj.get_property() and obj.props.

https://bugzilla.gnome.org/show_bug.cgi?id=723872
gtk-demo: Don't use deprecated constructor for Gtk.Label
configure.ac: pre release version bump to 3.13.90