C API PyObject_CallFunctionObjArgs returns incorrect result

Chris Angelico rosuav at gmail.com
Mon Mar 7 12:09:37 EST 2022


On Tue, 8 Mar 2022 at 04:06, Jen Kris via Python-list
<python-list at python.org> wrote:
> But with the C API it looks like this:
>
> PyObject *pSentence = PySequence_GetItem(pSents, sent_count);
> PyObject* str_sentence = PyObject_Str(pSentence);  // Convert to string
>
> PyObject* repr_str = PyObject_Repr(str_sentence);

You convert it to a string, then take the representation of that. Is
that what you intended?

ChrisA


More information about the Python-list mailing list