Skip to content

Commit cef03fa

Browse files
committed
Explicitly check if native access is allowed.
1 parent 5b4b3f2 commit cef03fa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ImpModuleBuiltins.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,10 @@ private Object loadDynamicModuleWithSpec(String name, String path, InteropLibrar
271271
private void ensureCapiWasLoaded() {
272272
PythonContext context = getContext();
273273
if (!context.hasCApiContext()) {
274+
if (!context.getEnv().isNativeAccessAllowed()) {
275+
throw raise(ImportError, ErrorMessages.NATIVE_ACCESS_NOT_ALLOWED);
276+
}
277+
274278
Env env = context.getEnv();
275279
CompilerDirectives.transferToInterpreterAndInvalidate();
276280

0 commit comments

Comments
 (0)