Skip to content

Commit d4b7813

Browse files
committed
Fix: close HPyTracker handle
1 parent a9a3b8e commit d4b7813

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy/GraalHPyContextFunctions.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,13 +1987,15 @@ public GraalHPyTrackerCleanup(boolean removeAll) {
19871987
@ExportMessage
19881988
Object execute(Object[] arguments,
19891989
@Cached HPyAsContextNode asContextNode,
1990-
@Cached HPyAsPythonObjectNode asPythonObjectNode) throws ArityException, UnsupportedTypeException {
1990+
@Cached HPyEnsureHandleNode ensureHandleNode,
1991+
@Cached ConditionProfile trackerHandleNativeProfile) throws ArityException, UnsupportedTypeException {
19911992
if (arguments.length != 2) {
19921993
CompilerDirectives.transferToInterpreterAndInvalidate();
19931994
throw ArityException.create(2, arguments.length);
19941995
}
19951996
GraalHPyContext nativeContext = asContextNode.execute(arguments[0]);
1996-
GraalHPyTracker builder = cast(asPythonObjectNode.execute(nativeContext, arguments[1]));
1997+
GraalHPyHandle trackerHandle = ensureHandleNode.execute(nativeContext, arguments[1]);
1998+
GraalHPyTracker builder = cast(trackerHandle.getDelegate());
19971999
if (builder == null) {
19982000
// that's really unexpected since the C signature should enforce a valid builder but
19992001
// someone could have messed it up
@@ -2004,6 +2006,7 @@ Object execute(Object[] arguments,
20042006
builder.removeAll();
20052007
} else {
20062008
builder.free(nativeContext, ConditionProfile.getUncached());
2009+
trackerHandle.close(nativeContext, trackerHandleNativeProfile);
20072010
}
20082011
return 0;
20092012
}

0 commit comments

Comments
 (0)