tmohr at s.netic.de
Fri Jul 18 17:03:43 CEST 2008
in an extension module i'd like to create a very large PyString.
As the string is very large i'd first like to create the string
and let Python allocate the space for it and then fill it from
But the only interface that i can find in Python/stringobject.h
PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t);
But my extension module does not have the data consecutively in memory.
If i'd use this function i'd first have to allocate the data, construct the
string and then let python _again_ allocate the same amount of memory
and copy my data.
Is there a way to tell python to:
1. let python create a PyString with an allocated buffer
2. let my extension module fill the buffer
3. let python validate the strings hash value and whatever else is
Thanks for any hints,
More information about the Python-list