60
60
import com .oracle .graal .python .builtins .objects .exception .PBaseException ;
61
61
import com .oracle .graal .python .builtins .objects .ints .PInt ;
62
62
import com .oracle .graal .python .builtins .objects .str .PString ;
63
+ import com .oracle .graal .python .nodes .SpecialAttributeNames ;
63
64
import com .oracle .graal .python .nodes .call .special .LookupAndCallUnaryNode ;
64
65
import com .oracle .graal .python .nodes .call .special .LookupAndCallUnaryNode .NoAttributeHandler ;
65
66
import com .oracle .graal .python .nodes .function .PythonBuiltinBaseNode ;
@@ -114,12 +115,11 @@ public void initialize(PythonCore core) {
114
115
builtinConstants .put ("dont_write_bytecode" , true );
115
116
116
117
String executable = PythonOptions .getOption (core .getContext (), PythonOptions .ExecutablePath );
117
- if (!executable .isEmpty () && core .getContext ().isExecutableAccessAllowed ()) {
118
- builtinConstants .put ("executable" , executable );
119
- } else if (TruffleOptions .AOT || !core .getContext ().isExecutableAccessAllowed ()) {
118
+ if (TruffleOptions .AOT || !core .getContext ().isExecutableAccessAllowed ()) {
120
119
// cannot set the path at this time since the binary is not yet known; will be patched
121
120
// in the context
122
121
builtinConstants .put ("executable" , PNone .NONE );
122
+ builtinConstants .put (SpecialAttributeNames .GRAAL_PYTHON_EXECUTABLE_LIST , PNone .NONE );
123
123
} else {
124
124
StringBuilder sb = new StringBuilder ();
125
125
ArrayList <String > exec_list = new ArrayList <>();
@@ -142,7 +142,12 @@ public void initialize(PythonCore core) {
142
142
sb .append ("com.oracle.graal.python.shell.GraalPythonMain" );
143
143
exec_list .add ("com.oracle.graal.python.shell.GraalPythonMain" );
144
144
builtinConstants .put ("executable" , sb .toString ());
145
- builtinConstants .put ("executable_list" , core .factory ().createList (exec_list .toArray ()));
145
+ builtinConstants .put (SpecialAttributeNames .GRAAL_PYTHON_EXECUTABLE_LIST , core .factory ().createList (exec_list .toArray ()));
146
+ }
147
+
148
+ String executable = PythonOptions .getOption (core .getContext (), PythonOptions .ExecutablePath );
149
+ if (!executable .isEmpty () && core .getContext ().isExecutableAccessAllowed ()) {
150
+ builtinConstants .put ("executable" , executable );
146
151
}
147
152
148
153
builtinConstants .put ("modules" , core .factory ().createDict ());
0 commit comments