Ticket #2112: builtins.c.patch

File builtins.c.patch, 829 bytes (added by Steven Watanabe, 14 years ago)
  • builtins.c

     
    16591659    FRAME       inner[1];
    16601660    LIST    *result;
    16611661    PARSE   *p;
     1662    PyObject *python_result;
    16621663    char*  rulename;
     1664    int i;
    16631665
    16641666    /* Build up the list of arg lists */
    16651667
     
    17091711    result = evaluate_rule( rulename, inner );
    17101712
    17111713    frame_free( inner );
     1714   
     1715    python_result = PyList_New(list_length(result));
     1716    for (i = 0; result; result = list_next(result), ++i)
     1717        PyList_SetItem(python_result, i, PyString_FromString(result->string));
    17121718
    1713     Py_INCREF(Py_None);
    1714     return Py_None;
     1719    list_free(result);
     1720
     1721    return python_result;
    17151722}
    17161723
    17171724/** Accepts three arguments: module name, rule name and Python callable.