427 static PyObject *
428 Radix_search_best(RadixObject *self, PyObject *args, PyObject *kw_args)
429 {
430 radix_node_t *node;
431 RadixNodeObject *node_obj;
432 prefix_t *prefix;
433 static char *keywords[] = { "network", "masklen", "packed", NULL };
434
435 char *addr = NULL, *packed = NULL;
436 long prefixlen = -1;
437 int packlen = -1;
438
439 if (!PyArg_ParseTupleAndKeywords(args, kw_args, "|sls#:search_best", keywords,
when PyArg_ParseTupleAndKeywords() succeeds
taking False path
440 &addr, &prefixlen, &packed, &packlen))
441 return NULL;
442 if ((prefix = args_to_prefix(addr, packed, packlen, prefixlen)) == NULL)
when treating unknown struct prefix_t * from radix_python.c:442 as NULL
taking True path
443 return NULL;
444
445 if ((node = radix_search_best(PICKRT(prefix, self), prefix)) == NULL ||
446 node->data == NULL) {
447 Deref_Prefix(prefix);
448 Py_INCREF(Py_None);
449 return Py_None;
450 }
451 Deref_Prefix(prefix);
452 node_obj = node->data;
453 Py_XINCREF(node_obj);
454 return (PyObject *)node_obj;
455 }
returning (PyObject*)NULL without setting an exception