Skip to content

Commit 0b6ee3f

Browse files
committed
Possible to set engine options when the context is updated.
1 parent 16102ea commit 0b6ee3f

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PythonContext.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ List<WeakReference<Thread>> getOwners() {
223223
// compat
224224
private final ThreadLocal<ArrayDeque<String>> currentImport = new ThreadLocal<>();
225225

226-
private final PythonEngineOptions engineOptions;
226+
private PythonEngineOptions engineOptions;
227227

228228
public PythonContext(PythonLanguage language, TruffleLanguage.Env env, PythonCore core) {
229229
this.language = language;
@@ -232,16 +232,10 @@ public PythonContext(PythonLanguage language, TruffleLanguage.Env env, PythonCor
232232
this.resources = new PosixResources();
233233
this.handler = new AsyncHandler(language);
234234
this.engineOptions = PythonEngineOptions.fromOptionValues(env.getOptions());
235-
if (env == null) {
236-
this.in = System.in;
237-
this.out = System.out;
238-
this.err = System.err;
239-
} else {
240-
this.resources.setEnv(env);
241-
this.in = env.in();
242-
this.out = env.out();
243-
this.err = env.err();
244-
}
235+
this.resources.setEnv(env);
236+
this.in = env.in();
237+
this.out = env.out();
238+
this.err = env.err();
245239
}
246240

247241
public ThreadGroup getThreadGroup() {
@@ -297,6 +291,7 @@ public void setEnv(TruffleLanguage.Env newEnv) {
297291
out = env.out();
298292
err = env.err();
299293
resources.setEnv(env);
294+
engineOptions = PythonEngineOptions.fromOptionValues(newEnv.getOptions());
300295
}
301296

302297
/**

0 commit comments

Comments
 (0)