Skip to content

Commit 4493414

Browse files
committed
Fix: close builder when build is called
1 parent 28504fd commit 4493414

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
@@ -2003,12 +2003,15 @@ public GraalHPyBuilderBuild(PythonBuiltinClassType type) {
20032003
@ExportMessage
20042004
Object execute(Object[] arguments,
20052005
@Cached HPyAsContextNode asContextNode,
2006-
@Cached HPyAsPythonObjectNode asPythonObjectNode,
2006+
@Cached HPyEnsureHandleNode ensureHandleNode,
2007+
@Cached ConditionProfile isAllocatedProfile,
20072008
@Cached PythonObjectFactory factory,
20082009
@Cached HPyAsHandleNode asHandleNode) throws ArityException, UnsupportedTypeException {
20092010
checkArity(arguments, 2);
20102011
GraalHPyContext nativeContext = asContextNode.execute(arguments[0]);
2011-
ObjectSequenceStorage builder = cast(asPythonObjectNode.execute(nativeContext, arguments[1]));
2012+
GraalHPyHandle listBuilderHandle = ensureHandleNode.execute(nativeContext, arguments[1]);
2013+
ObjectSequenceStorage builder = cast(listBuilderHandle.getDelegate());
2014+
listBuilderHandle.close(nativeContext, isAllocatedProfile);
20122015
if (builder == null) {
20132016
/*
20142017
* that's really unexpected since the C signature should enforce a valid builder but

0 commit comments

Comments
 (0)