Skip to content

Commit 9b9ccc8

Browse files
committed
Merge branch 'labs-numpy-hpy-port'
2 parents 699c732 + b7e1e83 commit 9b9ccc8

File tree

1 file changed

+13
-11
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy

1 file changed

+13
-11
lines changed

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

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,8 @@ void write(WriteAttributeToObjectNode writeAttributeToObjectNode, ReadAttributeF
502502
* that we cannot easily do the same since we have two separate sets of slots: HPy
503503
* slots and legacy slots. Right now, the HPy slots have precedence.
504504
*/
505-
if (!keyExists(readAttributeFromObjectNode, enclosingType, key)) {
506-
writeAttributeToObjectNode.execute(enclosingType, key, value);
505+
if (!keyExists(readAttributeFromObjectNode, enclosingType, prop.key)) {
506+
writeAttributeToObjectNode.execute(enclosingType, prop.key, prop.value);
507507
}
508508
}
509509
}
@@ -948,15 +948,17 @@ static HPyProperty doIt(GraalHPyContext context, Object enclosingType, Object sl
948948
default:
949949
// this is the generic slot case
950950
String attributeKey = slot.getAttributeKey();
951-
if (attributeKey != null && !HPyProperty.keyExists(readAttributeToObjectNode, enclosingType, attributeKey)) {
952-
Object pfuncPtr = callHelperFunctionNode.call(context, GraalHPyNativeSymbol.GRAAL_HPY_LEGACY_SLOT_GET_PFUNC, slotDef);
953-
/*
954-
* TODO(fa): Properly determine if 'pfuncPtr' is a native function pointer
955-
* and thus if we need to do result and argument conversion.
956-
*/
957-
PBuiltinFunction method = PExternalFunctionWrapper.createWrapperFunction(attributeKey, pfuncPtr, enclosingType, 0,
958-
slot.getSignature(), PythonLanguage.get(raiseNode), factory, true);
959-
writeAttributeToObjectNode.execute(enclosingType, attributeKey, method);
951+
if (attributeKey != null) {
952+
if (!HPyProperty.keyExists(readAttributeToObjectNode, enclosingType, attributeKey)) {
953+
Object pfuncPtr = callHelperFunctionNode.call(context, GraalHPyNativeSymbol.GRAAL_HPY_LEGACY_SLOT_GET_PFUNC, slotDef);
954+
/*
955+
* TODO(fa): Properly determine if 'pfuncPtr' is a native function
956+
* pointer and thus if we need to do result and argument conversion.
957+
*/
958+
PBuiltinFunction method = PExternalFunctionWrapper.createWrapperFunction(attributeKey, pfuncPtr, enclosingType, 0,
959+
slot.getSignature(), PythonLanguage.get(raiseNode), factory, true);
960+
writeAttributeToObjectNode.execute(enclosingType, attributeKey, method);
961+
}
960962
} else {
961963
// TODO(fa): implement support for remaining legacy slot kinds
962964
CompilerDirectives.transferToInterpreterAndInvalidate();

0 commit comments

Comments
 (0)