468,306 Members | 1,421 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,306 developers. It's quick & easy.

swig %typemap generated list typeerror

I'm trying to map a security_context_t ** to a python list. After
calling the method that returns this type when I process the returned
list in a for loop I get:
TypeError: expected string or Unicode object, NoneType found
after processing the last list entry. Can anyone see what I'm doing
wrong? Do I need to do something else to the list to somehow terminate
it?

%typemap(argout) security_context_t ** {
PyObject *list_security_context = PyList_New(0); // Create the
list.
if (list_security_context) {
security_context_t **p_p_security_context_t = arg3;
while (*p_p_security_context_t) { // Move each string
into the list.
security_context_t *p_security_context_t =
*p_p_security_context_t;
if (PyList_Append(list_security_context,
PyString_FromString((char
*)*p_security_context_t)) < 0) {
fprintf(stderr, "Fail to insert item in
list.\n");
$result = -1;
break;
}
p_p_security_context_t++;
}
}
else {
fprintf(stderr, "Fail to create list.\n");
$result = -1;
}

$result = SWIG_Python_AppendOutput($result,
list_security_context);

}

May 14 '07 #1
0 989

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by David Eger | last post: by
2 posts views Thread by Istvan Albert | last post: by
1 post views Thread by Ernie | last post: by
reply views Thread by Chris | last post: by
reply views Thread by James Carroll | last post: by
1 post views Thread by Java and Swing | last post: by
3 posts views Thread by Java and Swing | last post: by
2 posts views Thread by ajikoe | last post: by
reply views Thread by RocketIII | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.