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 637615 - Unable to compare Gtk.TreePath with None
Unable to compare Gtk.TreePath with None
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2010-12-19 22:12 UTC by jessevdk@gmail.com
Modified: 2010-12-20 16:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Allow comparing Gtk.TreePath to None (947 bytes, patch)
2010-12-19 22:12 UTC, jessevdk@gmail.com
none Details | Review
Allow comparing Gtk.TreePath to None (2.09 KB, patch)
2010-12-20 00:38 UTC, jessevdk@gmail.com
committed Details | Review

Description jessevdk@gmail.com 2010-12-19 22:12:00 UTC
The following fails:

if path != None:
    pass

	Due to the override in Gtk.py:921 which directly calls tree_path_compare which doesn't accept None. Check for none should be added (similar
Comment 1 jessevdk@gmail.com 2010-12-19 22:12:02 UTC
Created attachment 176728 [details] [review]
Allow comparing Gtk.TreePath to None
Comment 2 johnp 2010-12-19 23:27:52 UTC
Comment on attachment 176728 [details] [review]
Allow comparing Gtk.TreePath to None

Don't we need this for the other richcompare functions?  You might never do 
if tree_path > None:

 but you might do 

a = None
if tree_path > a:

I'm not sure if that should error out or always return True.

Also can you add a test to tests/test_overrides.py?
Comment 3 jessevdk@gmail.com 2010-12-20 00:38:16 UTC
Created attachment 176734 [details] [review]
Allow comparing Gtk.TreePath to None
Comment 4 jessevdk@gmail.com 2010-12-20 00:39:09 UTC
At first I wasn't sure whether the others made any logical sense to not error out, but after checking pythons behavior for other objects, I implemented them accordingly. See attached patch (also includes tests).
Comment 5 johnp 2010-12-20 16:53:47 UTC
Attachment 176734 [details] pushed as 78ea84c - Allow comparing Gtk.TreePath to None