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 607664 - Add support for nullable arguments
Add support for nullable arguments
Status: RESOLVED DUPLICATE of bug 616035
Product: pygi
Classification: Deprecated
Component: general
unspecified
Other Linux
: Normal enhancement
: 0.6
Assigned To: pygi-maint
pygi-maint
: 609200 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-01-21 15:00 UTC by Simon van der Linden
Modified: 2010-04-18 14:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add tests for nullable strings (4.90 KB, patch)
2010-01-22 12:31 UTC, Simon van der Linden
reviewed Details | Review

Description Simon van der Linden 2010-01-21 15:00:00 UTC
/**
 * test_gi_int8_inout_null:
 * int8: (inout) (allow-none):
 */
void
test_gi_int8_inout_null (gint8 *int8)
{
    g_assert(int8 == NULL);
}


======================================================================
ERROR: test_int8_inout_null (test_gi.TestInt8)
----------------------------------------------------------------------
Traceback (most recent call last):
  • File "/home/svdlinden/Workspaces/gnome/pygi/tests/test_gi.py", line 113 in test_int8_inout_null
    self.assertEquals(None, TestGI.int8_inout_null(None))
  • File "../gi/types.py", line 39 in function
    return info.invoke(*args)
TypeError: int() argument must be a string or a number, not 'NoneType'

Comment 1 Simon van der Linden 2010-01-21 15:02:04 UTC
The code that should support that is based on g_type_info_is_pointer, which shouldn't be used for that.
Comment 2 Simon van der Linden 2010-01-22 10:58:13 UTC
Hm, no, I read the code a little bit too quickly. Nullable arguments are not supported.
Comment 3 Simon van der Linden 2010-01-22 12:31:36 UTC
Created attachment 152004 [details] [review]
Add tests for nullable strings

Here are a few tests for null strings as arguments. That should be extended to all types that get passed by reference.

Note that I'm not sure of the semantic of inout and out nullable arguments: passing NULL, or a pointer to NULL? In the first case, the caller discards the output argument, while in the second case the caller doesn't pass an input argument.
Comment 4 Simon van der Linden 2010-02-08 18:13:21 UTC
*** Bug 609200 has been marked as a duplicate of this bug. ***
Comment 5 Zach Goldberg 2010-04-17 21:03:02 UTC
Review of attachment 152004 [details] [review]:

I was able to reuse a lot of this in 616035, thanks!
Comment 6 Tomeu Vizoso 2010-04-18 14:46:35 UTC

*** This bug has been marked as a duplicate of bug 616035 ***