Skip to content

Commit 4bd57be

Browse files
committed
Fix: do not crash nativeMemberStore is null
1 parent 6e2f2aa commit 4bd57be

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,13 +1024,19 @@ static Object doFCode(PFrame object, @SuppressWarnings("unused") PythonNativeWra
10241024
// TODO fallback guard
10251025
@Specialization
10261026
static Object doGeneric(@SuppressWarnings("unused") Object object, DynamicObjectNativeWrapper nativeWrapper, String key,
1027-
@CachedLibrary(limit = "1") HashingStorageLibrary lib) throws UnknownIdentifierException {
1027+
@CachedLibrary(limit = "1") HashingStorageLibrary lib,
1028+
@Shared("toSulongNode") @Cached ToSulongNode toSulongNode,
1029+
@Cached GetNativeNullNode getNativeNullNode) throws UnknownIdentifierException {
10281030
// This is the preliminary generic case: There are native members we know that they
10291031
// exist but we do currently not represent them. So, store them into a dynamic object
10301032
// such that native code at least reads the value that was written before.
10311033
if (nativeWrapper.isMemberReadable(key)) {
10321034
logGeneric(key);
1033-
return lib.getItem(nativeWrapper.getNativeMemberStore(), key);
1035+
DynamicObjectStorage nativeMemberStore = nativeWrapper.getNativeMemberStore();
1036+
if (nativeMemberStore != null) {
1037+
return lib.getItem(nativeMemberStore, key);
1038+
}
1039+
return toSulongNode.execute(getNativeNullNode.execute());
10341040
}
10351041
throw UnknownIdentifierException.create(key);
10361042
}

0 commit comments

Comments
 (0)