Python: highlight method: no need to copy the output unicode object
This commit is contained in:
parent
08bd33090c
commit
4b60a6a462
@ -1293,10 +1293,11 @@ Query_highlight(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
|
|||||||
PyErr_SetString(PyExc_ValueError, "Plaintorich failed");
|
PyErr_SetString(PyExc_ValueError, "Plaintorich failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
// cf python manual:The bytes will be interpreted as being UTF-8 encoded.
|
||||||
PyObject* unicode = PyUnicode_FromStringAndSize(out.begin()->c_str(),
|
PyObject* unicode = PyUnicode_FromStringAndSize(out.begin()->c_str(),
|
||||||
out.begin()->size());
|
out.begin()->size());
|
||||||
return Py_BuildValue("u#", PyUnicode_AsUnicode(unicode),
|
// We used to return a copy of the unicode object. Can't see why any more
|
||||||
PyUnicode_GetSize(unicode));
|
return unicode;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(doc_Query_makedocabstract,
|
PyDoc_STRVAR(doc_Query_makedocabstract,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user