Author yocaba
Recipients amak, yocaba
Date 2016-08-23.06:51:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Thanks again for your help. We tested to pass a new ScriptContext instance to each call of the eval method. We use the SimpleScriptContext implementation as suggested. Thereby, we inject a new Writer instance for standard output to each ScriptContext instance. But the result stays the same: the outputs of the script evaluated get interleaved if the eval methods (incl. the instantiation of PyScriptEngine, ScriptContext, and Writer) are called in parallel in different threads.

From your note 1) ("This cannot be done through PyScriptEngine, which shares the same PySystemState object across all PythonInterpreters.") and also from the code of PyScriptEngine and PythonInterpreter I wouldn't expect that to work either.
Refered to version 2.7.0: In the contructor of the PyScriptEngine a new instance of PythonInterpreter is created with the help of its static factory method threadLocalStateInterpreter(). The method passes null for the PySystemState to the constructor of PythonInterpreter. In the case of a null PySystemState the PythonInterpreter constructor instantiates the PySystemState with Py.getSystemState(). As I don't see any changes to the PySystemState field later on in the class, I'd assume that all PyScriptEngine instances share the same PySystemState no matter if a new ScriptContext instance is set to the engine or passed to the eval method or not. But I simply might miss something here.
Date User Action Args
2016-08-23 06:51:33yocabasetmessageid: <>
2016-08-23 06:51:33yocabasetrecipients: + yocaba, amak
2016-08-23 06:51:33yocabalinkissue2513 messages
2016-08-23 06:51:32yocabacreate