summaryrefslogtreecommitdiff
path: root/gi
Commit message (Collapse)AuthorAgeFilesLines
* Fix Gdk.rectangle_intersect/rectangle_union missing with GTK+ 3.18Christoph Reiter2015-10-111-0/+8
| | | | | | | | | 3.18 added a Gdk.Rectangle type which changed these functions to methods in the gir. Fix by providing aliases in the Gdk overrides. https://bugzilla.gnome.org/show_bug.cgi?id=756364
* Don't emit require_version warning if namespace was loaded previously using ↵Christoph Reiter2015-10-112-69/+43
| | | | | | | | | | | | | | | | | | | g_irepository_require Instead of tracking loaded dependencies ourself to hide warnings if they were loaded by a previous import just look if the namespace was loaded before the import. This (a) makes the implementation much simpler and (b) also takes into account namespaces loaded outside of Python/PyGObject using the libgirepository C API (as is common in applications using libpeas with Python plugins) This also introduces a new Python wrapper for g_irepository_is_registered() to allow checking the loading state of namespaces before imports. This fixes unnecessary require_version warnings in gedit, gnome-builder, totem, rhythmbox etc. https://bugzilla.gnome.org/show_bug.cgi?id=754491
* Allow passing unicode lists to GStrv properties on Python 2Christoph Reiter2015-07-171-9/+32
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=744745
* Avoid a silent long to int truncationRui Matos2015-07-171-2/+2
| | | | | | | | | | If the python object contains a value bigger than MAXUINT we'd silently truncate it when assigning to 'val' and the if condition would always be true. This was caught by a coverity scan. https://bugzilla.gnome.org/show_bug.cgi?id=749698
* Handle gtype marshallingMathieu Bridon2015-07-051-0/+5
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=749696
* pygi-foreign-cairo.c: fix include for py3cairo.hDaniel Hahler2015-07-031-1/+1
| | | | | | The pkg-config info includes the "pycairo" folder already. https://bugzilla.gnome.org/show_bug.cgi?id=746742
* Fix gcc warning regarding uninitialized use of variableChristoph Reiter2015-07-021-1/+3
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=751156
* Explicitly check if an override exists instead of ImportErrorGarrett Regier2015-06-211-2/+15
| | | | | | | | | | | | | If an override depended on another module and it did not exist then the raised ImportError was consumed and assumed to mean that the override did not exist. This makes it difficult to diagnose issues with overrides. This uses pkgutil.get_loader() as it is the easier way to determine if a module exists in both Python 2 and 3 and avoid deprecated functions. https://bugzilla.gnome.org/show_bug.cgi?id=749532
* Add gi.PyGIWarning and use it instead of PyGIDeprecationWarning in case the ↵Christoph Reiter2015-06-023-1/+10
| | | | | | | | | version to import wasn't specified. This makes the warning visible by default. See commit ef3bff4e570363e4f383d4cdae9cecd4073b03d8 for more info on the warning. https://bugzilla.gnome.org/show_bug.cgi?id=727379
* Remove Gdk.Rectangle alias with newer gobject-introspection and GTK+Christoph Reiter2015-05-311-4/+8
| | | | | | | | | The new GdkRectangle in the typelib confuses the marshalling code as PyGObject uses the Python class from the overrides for marshalling to Python but uses the gtype from the typelib to do type checking when marshalling from Python. https://bugzilla.gnome.org/show_bug.cgi?id=749625
* overrides: Provide _overrides_module attribute to make gst-python overrides ↵Christoph Reiter2015-04-231-0/+7
| | | | | | | | | | | | work again. gi_gst_fraction_from_value () in gst-python's gstmodule.c tries to access the Gst.Fraction class through gi.repository.Gst._overrides_module.Fraction and failed since _overrides_module was removed in revision 149c31beced944c. This adds it back pointing to the proxy itself which also contains Gst.Fraction. https://bugzilla.gnome.org/show_bug.cgi?id=736678#c6
* overrides: Conditionalize touch override support in GdkSimon Feltman2015-04-131-5/+13
| | | | | | | Conditionalize Gdk.EventTouch union discrimination. This fixes the Gdk overrides to continue working with versions of Gdk less than 3.4. https://bugzilla.gnome.org/show_bug.cgi?id=747717
* Field setters: Remove unneeded type/range checks and resulting unused code.Christoph Reiter2015-03-303-653/+75
| | | | | | | | | | These checks are performed in the actual marshalling code paths as well, no need to do them twice. Also move _pygi_g_registered_type_info_check_object() to pygi-info.c as it's the only place where it is still used. https://bugzilla.gnome.org/show_bug.cgi?id=746985
* pygi-argument: Remove unused imports/includesChristoph Reiter2015-03-303-10/+0
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=746985
* Add GLib.MINFLOAT etc. and mark GObject.G_MINFLOAT etc. deprecated.Christoph Reiter2015-03-032-1/+15
| | | | | | | | They are defined in glib, not gobject and not included in the gir; Similar constants like G_MAXINT64 are defined in GLib gir and marked deprecated in the GObject overrides already. https://bugzilla.gnome.org/show_bug.cgi?id=743514
* Emit PyGIDeprecationWarning when accessing deprecated override attributes.Christoph Reiter2015-03-033-57/+151
| | | | | | | | | | | | | | | | | | Adds a new helper function for overrides to mark a module level attribute as deprecated. A warning will be emitted every time the attribute gets accessed. e.g. when marking GObject.STATUS_FOO as deprecated using STATUS_FOO = GLib.Status.FOO deprecated_attr("GObject", "STATUS_FOO", "GLib.Status.FOO") __all__.append("STATUS_FOO") accessing it will emit "GObject.STATUS_FOO is deprecated; use GLib.Status.FOO instead" https://bugzilla.gnome.org/show_bug.cgi?id=743514
* Add namespace and container name to callable cache and include them in all ↵Christoph Reiter2015-03-034-18/+71
| | | | | | warnings/error messages. https://bugzilla.gnome.org/show_bug.cgi?id=743468
* Avoid duping filenames when marshalling from Python to CGarrett Regier2015-03-011-6/+6
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=744719
* Ignore deprecation warning for g_option_group_free()Simon Feltman2015-02-201-1/+4
|
* Avoid copying bytearrays from Python to C when transfer nothingGarrett Regier2015-02-161-4/+19
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=743278
* Allows passing arguments to opaque Boxed typesGarrett Regier2015-01-242-1/+16
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=743214
* Emit ImportWarning when gi.require_version() is not usedChristoph Reiter2015-01-242-2/+132
| | | | | | | | | gi tries to import the latest version of typelibs which can cause existing code to break when a newer typelib is released. Emit an ImportWarning when gi.require_version() is not used to give developers this awareness so they can future proof their code. https://bugzilla.gnome.org/show_bug.cgi?id=727379
* Refactor overrides import/modulesChristoph Reiter2015-01-243-109/+101
| | | | | | | | Removes Registry and DynamicModule in favor of a simple module wrapper that contains only overrides and falls back to the introspection module. Moves all the overrides logic into gi.overrides; Speeds up module attribute access https://bugzilla.gnome.org/show_bug.cgi?id=736678
* Replace statically bound GLib.Variant.new_tuple() with GISimon Feltman2015-01-242-46/+5
| | | | | | | | | Remove the static implementation of _wrap_pyg_variant_new_tuple with usage of the dynamic version coming from GI. Array marshalling has drastically improved in recent years making the dynamic version usable with a small compatibility shim for the arguments. https://bugzilla.gnome.org/show_bug.cgi?id=735199
* overrides: Add Gdk.EventTouch union discriminationSimon Feltman2015-01-241-0/+5
| | | | | | | | | Add EventTouch to get/setattr pass-through to support BEGIN, UPDATE, END, and CANCEL touch event types. Ensure Gdk.Event methods get_state(), get_axis(), get_coords(), and get_root_coords() are patched onto Gdk.EventTouch. https://bugzilla.gnome.org/show_bug.cgi?id=736380
* PyGObjectFlags: Remove a trailing comma on the enum.Murray Cumming2014-12-021-1/+1
| | | | Because this produces a g++ pedantic warning.
* Remove redefinitions of function and vfunc cache typedefsSimon Feltman2014-10-271-4/+4
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=737874
* Fix invalid read error in argument cleanup codeSimon Feltman2014-09-102-5/+9
| | | | | | Always set initial length argument index for arrays to -1. Ensure we don't attempt retrieving Python cleanup arguments until we know it is valid. This was causing an invalid read in test_gi.TestArray.test_array_out()
* Fix memory management problems with struct arguments to signalsSimon Feltman2014-09-083-6/+59
| | | | | | | | | | | Replicate struct marshaling logic for determining if struct arguments to signals should be passed by reference to callbacks. Maintain a list of these structs and apply an in-place copy of the struct pointer if the struct wrapper is held longer than the duration of the Python callback. This allows for both mutation of struct arguments from callbacks as well as memory safety incase a callbacks holds onto the struct. https://bugzilla.gnome.org/show_bug.cgi?id=736175
* Limit foreign struct checks to GI_INFO_TYPE_STRUCTSimon Feltman2014-09-082-5/+13
| | | | | | Add struct type check before calling g_struct_info_is_foreign(). https://bugzilla.gnome.org/show_bug.cgi?id=736175
* docs: Skip "Constructors" header for anonymous structsSimon Feltman2014-09-011-2/+6
| | | | | Structs which don't have a size or constructor should not procuce any doc string. The trailing "::" was causing a problem with sphinx.
* docs: Fix error when using may_return_null()Simon Feltman2014-09-011-1/+2
| | | | Fix error with an untested code path opened up by commit 1f78dc0ace.
* docs: Fix function doc string generator return typesSimon Feltman2014-08-291-1/+1
| | | | | Change skip_return() access into a function call. This was causing return type doc strings to always be skipped.
* Special case signal output arguments which are structs as pass-by-referenceSimon Feltman2014-08-291-6/+35
| | | | | | | | | | | Add a special case which avoids copying of struct arguments marked as output to signals. Since we don't currently support output arguments, users have come to rely on a pass-by-reference bug which was fixed and caused this to regress (bug 722899). Add unittest which is currently failing due to a number of issues with emit() not supporting type annotations or output arguments (bug 735693). https://bugzilla.gnome.org/show_bug.cgi?id=735486
* Ignore closure callbacks when Python is not initializedSimon Feltman2014-08-271-0/+7
| | | | | | | | Add an immediate return in ffi closures if Python is not initialized. This fixes rare events when which lead to a segfault when a process is exiting. https://bugzilla.gnome.org/show_bug.cgi?id=722562
* Change boxed init with args to warn instead of raiseChristoph Reiter2014-08-221-1/+4
| | | | | | | | | Replace raising a TypeError in gi.types.Boxed() with a warning. Even though passing arguments or keywords to the parent class is incorrect here, raising an exception was causing a bit of fallout in some apps (Gramps). https://bugzilla.gnome.org/show_bug.cgi?id=727810
* Revert "Replace statically bound GLib.Variant.new_tuple() with GI"Simon Feltman2014-08-212-5/+46
| | | | | This was accidentally pushed. Revert commit 35c6540c42a01e1155f44533cc09e6c9f94b6613.
* Fix crash in GList/GSList marshaling error handling path.Christoph Reiter2014-08-211-2/+2
| | | | | | In case PySequence_GetItem() failed, the retured NULL was passed to PyDECREF. https://bugzilla.gnome.org/show_bug.cgi?id=735201
* Replace statically bound GLib.Variant.new_tuple() with GISimon Feltman2014-08-212-46/+5
| | | | | | | | | Remove the static implementation of _wrap_pyg_variant_new_tuple with usage of the dynamic version coming from GI. Array marshalling has drastically improved in recent years making the dynamic version usable with a small compatibility shim for the arguments. https://bugzilla.gnome.org/show_bug.cgi?id=735199
* Fix reference counting problems with GLib.Variant.new_tuple()Simon Feltman2014-08-211-0/+1
| | | | | | | | Always sink the results of g_variant_new_tuple() in the statically bound wrapper. This matches the generic GI marshalling behavior of passing GVariants to Python with transfer-none. https://bugzilla.gnome.org/show_bug.cgi?id=735166
* Skip marshalling NULL output arguments in Python closuresSimon Feltman2014-08-201-1/+2
| | | | | | | Skip marshalling optional output arguments which are passed NULL as the memory location. This fixes fallout from bug 727004. https://bugzilla.gnome.org/show_bug.cgi?id=735090
* Fast path Python Property getter when accessed through GObject interfacesSimon Feltman2014-08-183-15/+34
| | | | | | | | | 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
* Fast path Python Property getter when accessing descriptor directlySimon Feltman2014-08-181-4/+15
| | | | | | | | | 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
* Don't use GI type for determining pointer extraction from GValuesSimon Feltman2014-08-181-6/+4
| | | | | | 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 property access for basic typesSimon Feltman2014-08-172-8/+27
| | | | | | | | | | 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
* Break pyg_value_as_pyobject into two functionsSimon Feltman2014-08-172-12/+68
| | | | | | | | | 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
* Unify property gettersSimon Feltman2014-08-173-109/+77
| | | | | | | | | | | 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
* Merge pygi_get_property_value and _pygi_argument_from_g_valueSimon Feltman2014-08-172-136/+28
| | | | | | | | | | | 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
* Never dup data structures when marshaling signal in argumentsSimon Feltman2014-08-172-4/+4
| | | | | | | | 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
* Never dup data structures when marshaling from g_object_get_property()Simon Feltman2014-08-171-17/+7
| | | | | | | | | 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