[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help on convert PyObject to string (c) Python 3.6

Jason Qian via Python-list schrieb am 04.02.2018 um 17:52:
>    This is the case of calling python from c and the python function  will
> return a string.

Hi Jason,

I noticed that you ran into a couple of problems using the C-API, so I
suggest looking into Cython instead. It basically translates Python to C
and supports optional static usage of C and C++ data types, so you get all
the native code interaction *and* all the Python interaction and features,
without having to go through the hassle of learning how the Python
internals work (and why they don't work for you). The code it generates is
probably also faster and safer than what you are currently writing (no
offence, just experience from reading and writing a lot of such code).