Beispiel #1
0
static PyObject *py_dump(PYARGS)
{
    PyObject *object = NULL;
    PyObject *indent = NULL;
    PyObject *stream = NULL;
    PyObject *result = NULL;
    yajl_gen_config config = { 0, NULL };
    static char *kwlist[] = {"object", "stream", "indent", NULL};
    char *spaces = NULL;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|O", kwlist, &object, &stream, &indent)) {
        return NULL;
    }

    spaces = __config_gen_config(indent, &config);
    if (PyErr_Occurred()) {
        return NULL;
    }
    result = _internal_stream_dump(object, stream, 0, config);
    if (spaces) {
        free(spaces);
    }
    return result;
}
Beispiel #2
0
static PyObject *py_dump(PYARGS)
{
    return _internal_stream_dump(args, 0);
}