@@ -787,7 +787,7 @@ public long spawnTruffleContext(PythonContext context, int fd, int sentinel, int
787
787
}
788
788
789
789
Builder builder = data .parentCtx .env .newContextBuilder ().config (PythonContext .CHILD_CONTEXT_DATA , data );
790
- Thread thread = data .parentCtx .env .createThread (new ChildContextThread (context , fd , sentinel , data , builder ));
790
+ Thread thread = data .parentCtx .env .createThread (new ChildContextThread (fd , sentinel , data , builder ));
791
791
792
792
// TODO always force java posix in spawned
793
793
long tid = thread .getId ();
@@ -819,30 +819,28 @@ private static class ChildContextThread implements Runnable {
819
819
private final ChildContextData data ;
820
820
private final Builder builder ;
821
821
private final int sentinel ;
822
- private final PythonContext context ;
823
822
824
- public ChildContextThread (PythonContext context , int fd , int sentinel , ChildContextData data , Builder builder ) {
823
+ public ChildContextThread (int fd , int sentinel , ChildContextData data , Builder builder ) {
825
824
this .fd = fd ;
826
825
this .data = data ;
827
826
this .builder = builder ;
828
827
this .sentinel = sentinel ;
829
- this .context = context ;
830
828
}
831
829
832
830
@ Override
833
831
public void run () {
834
832
try {
835
833
LOGGER .fine ("starting spawned child context" );
834
+ Source source = Source .newBuilder (PythonLanguage .ID ,
835
+ "from multiprocessing.spawn import spawn_truffleprocess; spawn_truffleprocess(" + fd + ", " + sentinel + ")" ,
836
+ "<spawned-child-context>" ).internal (true ).build ();
837
+ CallTarget ct ;
838
+ ct = data .parentCtx .getEnv ().parsePublic (source );
836
839
TruffleContext ctx = builder .build ();
837
840
data .setTruffleContext (ctx );
838
841
Object parent = ctx .enter (null );
839
842
try {
840
- Source source = Source .newBuilder (PythonLanguage .ID ,
841
- "from multiprocessing.spawn import spawn_truffleprocess; spawn_truffleprocess(" + fd + ", " + sentinel + ")" ,
842
- "<spawned-child-context>" ).internal (true ).build ();
843
- CallTarget ct = context .getEnv ().parsePublic (source );
844
843
data .running .countDown ();
845
-
846
844
Object res = ct .call ();
847
845
int exitCode = CastToJavaIntLossyNode .getUncached ().execute (res );
848
846
data .setExitCode (exitCode );
0 commit comments