On 18 дек, 03:51, Aaron Brady <castiro...@gmail.com> wrote: (snip) > How did you get a reference to the original > string object, with which to increment its reference count?
Use the "O!" format instead of "s": PyObject *pystr; ... PyArg_ParseTuple(args, "O!", &PyStringObject, &pystr) ... Then you can use PyString_AS_STRING explicitly, and control ref. counts yourself. > How do you know its length to copy it into your own buffer? Use the "s#" format, as Gabriel has said. Ivan -- http://mail.python.org/mailman/listinfo/python-list