Skip to content

Commit 4d60764

Browse files
committed
Push down native access check in CPyObjectArrayWrapper.free
1 parent 2d3b5a4 commit 4d60764

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/CPyObjectArrayWrapper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,14 @@ void toNative(
192192
}
193193

194194
public void free(PythonNativeWrapperLibrary lib, ReleaseNativeWrapperNode releaseNativeWrapperNode) {
195-
if (!PythonContext.get(lib).isNativeAccessAllowed()) {
196-
CompilerDirectives.transferToInterpreterAndInvalidate();
197-
throw new RuntimeException(ErrorMessages.NATIVE_ACCESS_NOT_ALLOWED);
198-
}
199195
for (int i = 0; i < wrappers.length; i++) {
200196
releaseNativeWrapperNode.execute(wrappers[i]);
201197
}
202198
if (lib.isNative(this)) {
199+
if (!PythonContext.get(lib).isNativeAccessAllowed()) {
200+
CompilerDirectives.transferToInterpreterAndInvalidate();
201+
throw new RuntimeException(ErrorMessages.NATIVE_ACCESS_NOT_ALLOWED);
202+
}
203203
freeBoundary((long) lib.getNativePointer(this));
204204
}
205205
}

0 commit comments

Comments
 (0)