Help on convert PyObject to string (c) Python 3.6

Stefan Behnel stefan_ml at behnel.de
Mon Feb 19 15:23:38 EST 2018


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).

http://cython.org/

Stefan




More information about the Python-list mailing list