C API PyObject_CallFunctionObjArgs returns incorrect result

Chris Angelico rosuav at gmail.com
Mon Mar 7 12:33:07 EST 2022


On Tue, 8 Mar 2022 at 04:13, Jen Kris <jenkris at tutanota.com> wrote:
>
>
> The PyObject str_sentence is a string representation of a list.  I need to convert the list to a string like "".join because that's what the library call takes.
>

What you're doing is the equivalent of str(sentence), not
"".join(sentence). Since the join method is part of the string
protocol, you'll find it here:

https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_Join

ChrisA


More information about the Python-list mailing list