Skip to content

Commit 3f49bdd

Browse files
lukasstadlerfangerer
authored andcommitted
fix for importlib.reload
1 parent b384a55 commit 3f49bdd

File tree

1 file changed

+3
-1
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,9 @@ static int doGeneric(CApiContext capiContext, PythonModule module, Object module
19771977
* similar. We ignore that for now since the size will usually be very small
19781978
* and/or we could also use a Truffle buffer object.
19791979
*/
1980-
module.setNativeModuleState(alloc.alloc(mSize));
1980+
Object mdState = alloc.alloc(mSize == 0 ? 1 : mSize); // ensure non-null value
1981+
assert mdState != null && !InteropLibrary.getUncached().isNull(mdState);
1982+
module.setNativeModuleState(mdState);
19811983
}
19821984

19831985
// parse slot definitions

0 commit comments

Comments
 (0)