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 620804 - Make the "wrong argument count" exception more explicit.
Make the "wrong argument count" exception more explicit.
Status: RESOLVED FIXED
Product: pygi
Classification: Deprecated
Component: general
unspecified
Other All
: Normal normal
: 0.6
Assigned To: pygi-maint
pygi-maint
Depends on:
Blocks:
 
 
Reported: 2010-06-07 07:52 UTC by Steve Frécinaux
Modified: 2010-06-10 07:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make the "wrong argument count" exception more explicit. (1.28 KB, patch)
2010-06-07 07:56 UTC, Steve Frécinaux
accepted-commit_now Details | Review
Make the "wrong argument count" exception more explicit. (2.06 KB, patch)
2010-06-09 08:05 UTC, Steve Frécinaux
committed Details | Review

Description Steve Frécinaux 2010-06-07 07:52:18 UTC
This patch makes it easier to debug when there is an error due to
a wrong argument count in a pygi function call, by adding the
function name to the exception message.

You now get:
  • File "/opt/gnome2/lib/gitg/plugins/pythonconsole/console.py", line 94 in __init__
    buffer.create_mark("input-line", buffer.get_end_iter(), True)
  • File "/opt/gnome2/lib/python2.6/site-packages/gtk-2.0/gi/types.py", line 40 in function
    return info.invoke(*args)   TypeError: get_end_iter() takes exactly 2 argument(s) (1 given)

Comment 1 Steve Frécinaux 2010-06-07 07:56:39 UTC
Created attachment 162905 [details] [review]
Make the "wrong argument count" exception more explicit.

Previously we had messages like this one:
TypeError: takes exactly 2 argument(s) (1 given)

With this patch, they become like this:
TypeError: get_end_iter() takes exactly 2 argument(s) (1 given)

It makes things much easier to debug when there are several pygi calls
on the same line.
Comment 2 johnp 2010-06-08 17:32:56 UTC
Comment on attachment 162905 [details] [review]
Make the "wrong argument count" exception more explicit.

Looks good.  Please add a test before committing.  Simply take one of the functions from Everything and check that the error messages starts with the name of the function (there might even be a test that checks for wrong number of parameters that you could modify)
Comment 3 Steve Frécinaux 2010-06-09 08:05:15 UTC
Created attachment 163173 [details] [review]
Make the "wrong argument count" exception more explicit.

The same with a test against Everything.
Comment 4 johnp 2010-06-10 01:53:07 UTC
Comment on attachment 163173 [details] [review]
Make the "wrong argument count" exception more explicit.

there was no need to post another patch once I approved the first one.  I just wanted to make sure you added a test before committing.  Commit away.
Comment 5 johnp 2010-06-10 01:53:33 UTC
and close this bug once you commit
Comment 6 Steve Frécinaux 2010-06-10 07:33:46 UTC
Sure, I know you set it as accepted-commit-now, but I wanted to make sure
I did the test the right way at the right place.

I've now committed the patch into master.

Attachment 163173 [details] pushed as 07df124 - Make the "wrong argument count" exception more explicit.