-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-C-API
Description
Documentation
The documentation seems to be geared towards embedding scenarios and modifying the configuration, and I couldn't find an example for simply reading a PyConfig field.
PEP 587 seems similarly unhelpful.
Looking through the CPython sources, it appears that what I want to do is this:
PyThreadState *tstate = _PyThreadState_GET();
PyConfig* config = &tstate->interp->config;
int optimize_flag = config->optimization_level; // formerly known as Py_OptimizeFlagI'm pretty sure that this is not the official API way to do it, but it's unclear to me what the right way is, given that PyInterpreterState is an opaque struct and the previously simple access to Py_OptimizeFlag has been deprecated as of Py3.12.
Also, it's unclear what way of access should be used in the limited API.
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-C-API