pygobject / pgi

[Unmaintained: Use PyGObject instead] GTK+ / GObject Introspection Bindings for PyPy.
GNU Lesser General Public License v2.1
74 stars 16 forks source link

timeout_add calls callback with incorrect arguments #45

Closed anntzer closed 2 years ago

anntzer commented 6 years ago

Python 3.6 pgi 0.0.11.1 pygobject 3.26.1 Arch Linux

Consider

import gi; gi.require_version('Gtk', '3.0')
from gi.repository import GLib, Gtk

# import pgi as gi; gi.require_version('Gtk', '3.0')
# from pgi.repository import GLib, Gtk

import sys

def on_timer(*args, **kwargs):
    print(args, kwargs)
    sys.exit(0)

GLib.timeout_add(1, on_timer)

Gtk.main()

With gi, this correctly prints (), {}. With pgi, this incorrectly prints (None,), {}.

lazka commented 6 years ago

I'd suggest you drop support for pgi in matplotlib, I haven't really worked on it for years now.

If I remember correctly it was added to make testing easier? The new pygobject+pycairo should work in a virtualenv and be easily installable with pip and works with Ubuntu 16.04+ (pycairo with Ubuntu 14.04+).

lazka commented 6 years ago

If there are any issues making it hard to use pygobject I'd like to hear them!

anntzer commented 6 years ago

Yes, it's for testing purposes. Any chance you can provide the list of apt packages that need to be installed on travis? (found https://github.com/pygobject/pygobject-travis-ci-examples/blob/master/.travis.yml but that's not using a venv, but the system package, which we don't want).

lazka commented 6 years ago

Basic travis without docker? That would mean Ubuntu 14.04 which we currently don't support, but I can have a look.

lazka commented 6 years ago

This should cover it I think:

libcairo2-dev
libffi-dev
libgirepository1.0-dev
libglib2.0-dev
python-dev
python3-dev
pkg-config
build-essential
lazka commented 6 years ago

We also have a few docker examples for travis/circleci btw: https://github.com/pygobject/pygobject-travis-ci-docker-examples They just build/run the image without dockerhub etc.

anntzer commented 6 years ago

Looks like the version of girepository on travis (trusty) is too old? https://travis-ci.org/anntzer/matplotlib/jobs/355675792#L1274 / https://packages.ubuntu.com/trusty/libgirepository1.0-dev (I limited myself to installing libcairo2-dev and libgirepository1.0-dev, which seems enough for this purpose so far).

How hard would it be for pygobject to support girepository 1.40? (dunno how quickly this API changes, just curious)

We probably don't want to dockerize our tests.

lazka commented 6 years ago

It doesn't change much, but 4 years is a long time :/ A quick hack to make it build results in crashes, I'll have a look later.

lazka commented 6 years ago

There would be too many hacks needed that I feel comfortable with backporting to 3.28 and 14.04 will be EOL in a year, so I won't spend more time on this.

anntzer commented 6 years ago

No worries, we'll just stick with pgi until travis updates, then.

anntzer commented 2 years ago

Closed by #48, IIRC.