[Python-ideas] In-process interpreters

Niki Spahiev niki.spahiev at gmail.com
Fri Nov 19 10:38:19 CET 2010


On 19.11.2010 05:02, Terry Reedy wrote:
>
> I keep wondering whether it would be possible to rearrange the current
> code in any way that a) would not hinder performance significantly but
> b) would make it easier to maintain patches for compiler variations for
> the minority use cases.
>

Restating problem this way leads to this idea:

struct PythonStaticState {
    ...
};

#ifdef EMBED
#define GLOBAL_STATE_MACRO PythoStaticState globalPythonState,
#else
#define GLOBAL_STATE_MACRO
PythonStaticState globalPythonState;
#endif

PyObject * PyAnyApi(GLOBAL_STATE_MACRO, a, b, c, d)
{
	globalPythonState.var1 = 0;
}

and using good compiler and linker for nonembeded case ;^)

Niki




More information about the Python-ideas mailing list