@@ -119,7 +119,7 @@ public abstract static class ImportNode extends PythonBuiltinNode {
119
119
@ TruffleBoundary
120
120
public Object importSymbol (String name ) {
121
121
Env env = getContext ().getEnv ();
122
- if (!env .isPolyglotAccessAllowed ()) {
122
+ if (!env .isPolyglotBindingsAccessAllowed ()) {
123
123
throw raise (PythonErrorType .NotImplementedError , "polyglot access is not allowed" );
124
124
}
125
125
Object object = env .importSymbol (name );
@@ -137,7 +137,7 @@ abstract static class EvalInteropNode extends PythonBuiltinNode {
137
137
@ Specialization
138
138
Object evalString (@ SuppressWarnings ("unused" ) PNone path , String value , String langOrMimeType ) {
139
139
Env env = getContext ().getEnv ();
140
- if (!env .isPolyglotAccessAllowed ()) {
140
+ if (!env .isPolyglotEvalAllowed ()) {
141
141
throw raise (PythonErrorType .NotImplementedError , "polyglot access is not allowed" );
142
142
}
143
143
try {
@@ -148,14 +148,14 @@ Object evalString(@SuppressWarnings("unused") PNone path, String value, String l
148
148
if (mimeType ) {
149
149
newBuilder = newBuilder .mimeType (langOrMimeType );
150
150
}
151
- return env .parse (newBuilder .build ()).call ();
151
+ return env .parsePublic (newBuilder .build ()).call ();
152
152
} catch (RuntimeException e ) {
153
153
throw raise (NotImplementedError , e );
154
154
}
155
155
}
156
156
157
157
private void raiseIfInternal (Env env , String lang ) {
158
- LanguageInfo languageInfo = env .getLanguages ().get (lang );
158
+ LanguageInfo languageInfo = env .getPublicLanguages ().get (lang );
159
159
if (languageInfo != null && languageInfo .isInternal ()) {
160
160
throw raise (NotImplementedError , "access to internal language %s is not permitted" , lang );
161
161
}
@@ -165,7 +165,7 @@ private void raiseIfInternal(Env env, String lang) {
165
165
@ Specialization
166
166
Object evalFile (String path , @ SuppressWarnings ("unused" ) PNone string , String langOrMimeType ) {
167
167
Env env = getContext ().getEnv ();
168
- if (!env .isPolyglotAccessAllowed ()) {
168
+ if (!env .isPolyglotEvalAllowed ()) {
169
169
throw raise (PythonErrorType .NotImplementedError , "polyglot access is not allowed" );
170
170
}
171
171
try {
@@ -176,7 +176,7 @@ Object evalFile(String path, @SuppressWarnings("unused") PNone string, String la
176
176
if (mimeType ) {
177
177
newBuilder = newBuilder .mimeType (langOrMimeType );
178
178
}
179
- return getContext ().getEnv ().parse (newBuilder .name (path ).build ()).call ();
179
+ return getContext ().getEnv ().parsePublic (newBuilder .name (path ).build ()).call ();
180
180
} catch (IOException e ) {
181
181
throw raise (OSError , "%s" , e );
182
182
} catch (RuntimeException e ) {
@@ -188,11 +188,11 @@ Object evalFile(String path, @SuppressWarnings("unused") PNone string, String la
188
188
@ Specialization
189
189
Object evalFile (String path , @ SuppressWarnings ("unused" ) PNone string , @ SuppressWarnings ("unused" ) PNone lang ) {
190
190
Env env = getContext ().getEnv ();
191
- if (!env .isPolyglotAccessAllowed ()) {
191
+ if (!env .isPolyglotEvalAllowed ()) {
192
192
throw raise (PythonErrorType .NotImplementedError , "polyglot access is not allowed" );
193
193
}
194
194
try {
195
- return getContext ().getEnv ().parse (Source .newBuilder (PythonLanguage .ID , env .getTruffleFile (path )).name (path ).build ()).call ();
195
+ return getContext ().getEnv ().parsePublic (Source .newBuilder (PythonLanguage .ID , env .getTruffleFile (path )).name (path ).build ()).call ();
196
196
} catch (IOException e ) {
197
197
throw raise (OSError , "%s" , e );
198
198
} catch (RuntimeException e ) {
@@ -214,7 +214,7 @@ Object evalWithoutContent(Object path, Object string, Object lang) {
214
214
215
215
@ TruffleBoundary (transferToInterpreterOnException = false )
216
216
private static String findLanguageByMimeType (Env env , String mimeType ) {
217
- Map <String , LanguageInfo > languages = env .getLanguages ();
217
+ Map <String , LanguageInfo > languages = env .getPublicLanguages ();
218
218
for (String language : languages .keySet ()) {
219
219
for (String registeredMimeType : languages .get (language ).getMimeTypes ()) {
220
220
if (mimeType .equals (registeredMimeType )) {
@@ -240,7 +240,7 @@ public abstract static class ExportSymbolNode extends PythonBuiltinNode {
240
240
@ TruffleBoundary
241
241
public Object exportSymbolKeyValue (String name , Object value ) {
242
242
Env env = getContext ().getEnv ();
243
- if (!env .isPolyglotAccessAllowed ()) {
243
+ if (!env .isPolyglotBindingsAccessAllowed ()) {
244
244
throw raise (PythonErrorType .NotImplementedError , "polyglot access is not allowed" );
245
245
}
246
246
env .exportSymbol (name , value );
@@ -268,7 +268,7 @@ public Object exportSymbolAmbiguous(Object arg1, String arg2) {
268
268
@ TruffleBoundary
269
269
public Object exportSymbol (PFunction fun , @ SuppressWarnings ("unused" ) PNone name ) {
270
270
Env env = getContext ().getEnv ();
271
- if (!env .isPolyglotAccessAllowed ()) {
271
+ if (!env .isPolyglotBindingsAccessAllowed ()) {
272
272
throw raise (PythonErrorType .NotImplementedError , "polyglot access is not allowed" );
273
273
}
274
274
env .exportSymbol (fun .getName (), fun );
@@ -279,7 +279,7 @@ public Object exportSymbol(PFunction fun, @SuppressWarnings("unused") PNone name
279
279
@ TruffleBoundary
280
280
public Object exportSymbol (PBuiltinFunction fun , @ SuppressWarnings ("unused" ) PNone name ) {
281
281
Env env = getContext ().getEnv ();
282
- if (!env .isPolyglotAccessAllowed ()) {
282
+ if (!env .isPolyglotBindingsAccessAllowed ()) {
283
283
throw raise (PythonErrorType .NotImplementedError , "polyglot access is not allowed" );
284
284
}
285
285
env .exportSymbol (fun .getName (), fun );
@@ -322,7 +322,7 @@ protected static boolean isModule(Object o) {
322
322
@ TruffleBoundary
323
323
private void export (String name , Object obj ) {
324
324
Env env = getContext ().getEnv ();
325
- if (!env .isPolyglotAccessAllowed ()) {
325
+ if (!env .isPolyglotBindingsAccessAllowed ()) {
326
326
throw raise (PythonErrorType .NotImplementedError , "polyglot access is not allowed" );
327
327
}
328
328
env .exportSymbol (name , obj );
0 commit comments