After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 705530 - New style signals doesn't fully handle return_type
New style signals doesn't fully handle return_type
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
Git master
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2013-08-05 19:16 UTC by Daniel Narvaez
Modified: 2013-08-05 21:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Pass return values through the GObject.Signal.emit wrapper (3.66 KB, patch)
2013-08-05 21:18 UTC, Simon Feltman
committed Details | Review

Description Daniel Narvaez 2013-08-05 19:16:59 UTC
The following test prints "None" instead of "True" as expected

from gi.repository import GObject

class Test(GObject.GObject):
    close = GObject.Signal(flags=GObject.SignalFlags.RUN_LAST,
                           return_type=GObject.TYPE_BOOLEAN)

def close_cb(test):
    return True

t = Test()
t.close.connect(close_cb)
print t.close.emit()
Comment 1 Daniel Narvaez 2013-08-05 19:19:43 UTC
t.emit("close") works, so I think it's just a missing return here:

https://git.gnome.org/browse/pygobject/tree/gi/_gobject/signalhelper.py#n102
Comment 2 Simon Feltman 2013-08-05 21:18:26 UTC
The following fix has been pushed:
78f7265 Pass return values through the GObject.Signal.emit wrapper

While looking at this I noticed the Signal decorator also does
not support accumulators which I've logged as bug #705533
Comment 3 Simon Feltman 2013-08-05 21:18:29 UTC
Created attachment 250903 [details] [review]
Pass return values through the GObject.Signal.emit wrapper

Return the result of GObject.emit from the Signal decorators wrapping.
Update unittest for decorated return type to use skipUnless for Python 3.
Add test for Signal decorator return type.