Hello. I'm trying to embed a Py3.8 interpreter into a C++ application to
use as the "glue" for all the other components. We've come across some
complexities -- revolving around the use of frozen modules and multiple
interpreter states -- and I'm wondering if this is the correct list to seek
some assistance?
We can get a single interpreter running. We can add our stream objects and
capture the output, we can load our modules (giving the API access) into it
and generally everything seems fairly happy in single interp mode.
When we try and run a Py_NewInterpreter() to get us more interps to get
encapsulation between multiple scripts, it fails to launch (fails to get
filesystem's codec). The problem seems to be that the frozen modules added
to the launched interpreter are not cached after use. So the cloned
interpreter fails to start (it wants either an encoder search path which is
null for no filesystem OR to have the encodings module available). The
modules don't seem to be being cached because when the import runs them
with PyEval_EvalCode, they return nothing.
I suspect this is something I've missed about how to configure the original
interpreter, but documentation & use-examples for the new split-phase
initialisation are rather hard to find.
Cheers for any help you can provide,
Katie
Hi,
I pushed a few changes to hide even more implementation details from
the limited C API of CPython. See "Changes in the limited C API"
documentation at:
https://docs.python.org/dev/whatsnew/3.9.html#build-and-c-api-changes
I'm interesting to get your feedback on such changes.
I know that the PyQt project uses the limited C API. Apart from that,
I don't know other C extension using it.
One idea would be to consume it directly in CPython for a bunch of C
extensions. It would help to check if the API is complete enough for a
non-trivial extension. It should also help to detect issues earlier.
Currently, CPython only uses the limited C API the "xxlimited" which
is basically a test module only written to show how this API can be
used.
By the way, I just opened "Make PyObject an opaque structure in the
limited C API" issue:
https://bugs.python.org/issue39573
It's a follow-up on Neil Schemenauer's proof-of-concept of tagged
pointer in CPython that he wrote in September 2018.
Victor
--
Night gathers, and now my watch begins. It shall not end until my death.
Hi,
As one of the capi-sig list owners, I got many emails like:
"xxxx <xxx@xxx>'s subscription has been disabled on
capi-sig(a)python.org due to their bounce score exceeding the mailing
list's bounce_score_threshold."
I guess that many people subscribed long time ago when the list was
still run by Mailman 2 and Mailman 2 didn't have this feature. The
list migrated to Mailman 3 something like 1 year ago. I guess that
Mailman 3 started to disable many subscriptions because it has
stricter default policy on bouncing.
Anyway, if you don't get new emails (like this one), check your subscription at:
https://mail.python.org/mailman3/lists/capi-sig.python.org/
Victor
--
Night gathers, and now my watch begins. It shall not end until my death.