| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Why does a g_instance_init() function only handle GObjects?
|
|
|
|
|
|
| |
In theory it should no longer be needed, but PyPy hasn't
updated this part of their implementation yet, and not initing
threads will lead to crashes due to missing GIL init.
|
|
|
|
|
|
|
|
|
|
| |
If C code calls g_object_new() for a GInitiallyUnowned subclass
implemented in python, the expectation is to receive a floating
reference.
The solution is used is the same picked for
5efe2e5c8458d9f4d72329ea1209d96b5ebecfb4, this is simply a special
case that was omitted at the time.
|
| |
|
|
|
|
|
|
| |
Py_TYPE was changed to a function in Python 3.10. Suggested approach is
to use Py_SET_TYPE macro instead, see:
https://docs.python.org/3.10/whatsnew/3.10.html.
|
|
|
|
|
|
| |
The GIL is now created by Python at initialization time no matter what.
PyEval_InitThreads() triggers a deprecation warning and will be removed in
3.10 so don't use it with 3.9+.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a widget is inside a template it is created through a
g_object_new and does not have a python wrapper when
pygobject__g_instance_init is called. In that case, a wrapper is
created and the "__init__" method is called to instantiate it. Then,
"init_template" is called to init its own template (if it exists).
However, "init_template" needs to be called before the object
constructor in order to create and instantiate all its children,
signals and properties.
This issue is fixed by calling init_template before the contructor if
the python object has been created through g_object_new.
A new test for the template hierarchy is added (based on an example
from Marinus Schraal).
Closes: #257, #386
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
g_object_newv() and GParameter are deprecated now.
Replace all GParameter usage with a separate GValue and char* array
and add a compatibility function for g_object_new_with_properties()
that also works with older glib and converts things back to GParameter.
|
|
|
|
|
| |
This should make things build with -Werror again once we port things
to g_object_new_with_properties()
|
|
|
|
|
|
|
|
|
|
|
| |
To make deprecation warnings more visible we made it inherit from RuntimeWarning
with unstable releases and DeprecationWarning for stabel releases.
This is a bit confusing when being flooded with warnings when testing under jhbuild
etc. Also recent pytest has changed to show deprecation warnings triggered during
tests, so the warnings should be more visible now for devs using pytest.
This changes it to inherit from DeprecationWarning always again.
|
|
|
|
|
|
|
|
| |
The field marshalling code is slow and doesn't do any caching at all
which in turn makes accessing Value.g_type slow.
Add a static helper function for fetching the GType and use that instead.
This reduced the time for creating a GValue + setting it by ~30%
|
|
|
|
|
|
|
| |
Instead of iterating over the fields ourselves. g_struct_info_find_field() was added
for libgirepository 1.46: https://gitlab.gnome.org/GNOME/gobject-introspection/commit/cf6ea68018
We now depend on 1.46 so start using it.
|
|
|
|
|
|
| |
Otherwise we call into __getattr__ implementations of subclasses, like the
overrides for Gio.DBusProxy. This is particularly bad because the instance
isn't initialized at that point yet.
|
|
|
|
|
|
|
|
|
|
|
|
| |
some cases. Fixes #260
In case the first cairo marshall happens through the GType converters we wont have loaded the
cairo foreign module yet and wont have registered the right converters.
This results in the non-foreign version getting passed on which isn't accepted by all
other marshalling paths which use the foreign module.
Try importing the cairo foreign module at gi import type instead so the gtype converters
are registered.
|
|
|
|
|
|
|
|
| |
Calling tp_init under PyPy does not call the Python level __init__.
Filed under https://bitbucket.org/pypy/pypy/issues/2806
Just use PyObject_CallMethod() to call __init__ instead. It works
just as well and there is no perf difference from a quick test.
|
|
|
|
|
|
|
|
| |
Those functions use CompareDataFunc which works with pointers and doesn't know
anything about GObjects.
Add overrides which wrap the passed in sort function and convert the pointers
to proper Python wrappers.
|
|
|
|
| |
It's only used for that, so no need to have an extra Python wrapper.
|
| |
|
|
|
|
| |
They are simple aliases to the PyCapsule API, so just remove them.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This tries to add a minimal API which allows for basic template usage
with the possibility to maybe add more automation/subclassing/nesting
later on.
Compared to gi_composites.py this adds parameters to Child and Callback
to set the name, init_template() doesn't need to be called and is stricter
in what it supports to allow future improvements.
The _gtktemplate.py file should be resuable with older PyGObject versions
with the only difference that init_template() needs to be called.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
In some cases changing the type used was enough, in some others I just force
casted things as too many changes would be required and overflow unlikely
(for array marshalling the cache uses gssize while the marshalling code uses
garray and thus guint)
My hope is that having this enabled will improve things gradually with
future cleanups.
|
|
|
|
|
|
|
|
| |
through ctypes
PyPy doesn't support the ctypes.PyDLL interface.
The ctypes approach was a bit hacky anyway because the interface for loading the
python DLL isn't really documented.
|
| |
|
| |
|
| |
|
|
|
|
| |
No need to have two similarly named files
|
|
|
|
|
|
|
| |
This asserts that PyType_Ready() was called on the types before using them
to create instances or as base class for other types.
With this PyPy no longer crashes when importing the _gi module.
|
|
|
|
|
| |
They were all just ignoring errors.
Also change those functions to use the pygi prefix.
|
|
|
|
| |
There is no pyglib anymore
|
|
|
|
| |
Leftovers from the static bindings, move to their users.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of creating the closure cache on every call store
it in the arg cache.
The only potential problem here is that the arg cache owns the
closure cache and needs to stay around. But afaics the cache
stays around until interpreter shutdown and the closure
code guards against that and will simply do nothing then.
This would all be easier if the caches were refcounted.
|
|
|
|
|
|
|
|
| |
This finishes what was started in b2529624b3925adbef2671025e08cbf747f162e8
and moves the remaining code mostly into gimodule.
While this makes the large file even larger, it's a good starting point
for more cleanups.
|
| |
|
| |
|
| |
|
|
|
|
| |
All it does is provide GObject.features which we can do in the overrides directly.
|
| |
|
|
|
|
| |
This reverts commit a506d5e3c64321c43a4ce7c2a72ca8d36e985999.
|
|
|
|
| |
This reverts commit daefdfa3e4dc97b4ae38250358d722f09764cc9b.
|
|
|
|
| |
This reverts commit 85175047e66dfc0c0263eac91d8056a95d0a60a0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We use _PyGIDefaultArgPlaceholder as a sentinel value to represent default
values during function argument list construction. Right now, it's a Python
type object. We make it using PyObject_New, so most of its fields end up
uninitialized. The object body being uninitialized wouldn't be a problem if
the placeholder object were unreachable, but the object *can* be reached
during GC by traversal through frame objects.
Depending on the exact contents of the uninitialized memory, the GC can go on
to cause other kinds of memory corruption through the process.
IMHO, the easiest fix for this problem is to just make the placeholder a
simpler data structure, like a list.
https://bugzilla.gnome.org/show_bug.cgi?id=786872
|
|
|
|
|
|
|
|
|
|
| |
Expose everything from _gi._gobject in _gi instead.
This does not move any code around, just removes the module.
Also removes the gi._gobject package and replaces it
with a small dummy module in gi.__init__.py
https://bugzilla.gnome.org/show_bug.cgi?id=735206
|
|
|
|
|
|
|
| |
Move the code into gi._gi (gimodule)
The module was a leftover from https://bugzilla.gnome.org/show_bug.cgi?id=712197
https://bugzilla.gnome.org/show_bug.cgi?id=735206
|
|
|
|
|
|
|
|
| |
Due to the switch to AX_COMPILER_FLAGS which adds some more
warning flags. I didn't notice these as they only get triggered
on 32bit builds. Tested with gcc 6.3 and clang 3.9.
https://bugzilla.gnome.org/show_bug.cgi?id=780409
|
|
|
|
|
|
|
|
| |
This is useful for a the next commit which switches away from
gnome-common and uses AX_COMPILER_FLAGS adding some new compiler
warning flags.
https://bugzilla.gnome.org/show_bug.cgi?id=777713
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move all the random declarations in pygobject-private.h to their
respective header files. Rename pygobject.c to pygobject-object.c
so it's clearer that it's not the implementation of pygobject.h.
Add a new pygobject-internal.h which includes pygobject.h
with _INSIDE_PYGOBJECT_ defined like pygobject-private.h did.
In case you are looking at the git log and end up here due to the
rename try:
git log --follow pygobject-object.c
or on the web interface go to the history of the old file name:
https://git.gnome.org/browse/pygobject/log/gi/pygobject.c?id=6b702c052e9f26e809cff494f0c896d17a514c64
https://bugzilla.gnome.org/show_bug.cgi?id=767084
|