Skip to content

Commit bc402de

Browse files
committed
Fix: support built-in shape legacy in HPy_New
1 parent dd93a6c commit bc402de

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import static com.oracle.graal.python.builtins.PythonBuiltinClassType.TypeError;
4747
import static com.oracle.graal.python.builtins.PythonBuiltinClassType.ValueError;
4848
import static com.oracle.graal.python.builtins.objects.cext.hpy.GraalHPyDef.HPyType_BUILTIN_SHAPE_FLOAT;
49+
import static com.oracle.graal.python.builtins.objects.cext.hpy.GraalHPyDef.HPyType_BUILTIN_SHAPE_LEGACY;
4950
import static com.oracle.graal.python.builtins.objects.cext.hpy.GraalHPyDef.HPyType_BUILTIN_SHAPE_LIST;
5051
import static com.oracle.graal.python.builtins.objects.cext.hpy.GraalHPyDef.HPyType_BUILTIN_SHAPE_LONG;
5152
import static com.oracle.graal.python.builtins.objects.cext.hpy.GraalHPyDef.HPyType_BUILTIN_SHAPE_OBJECT;
@@ -2325,7 +2326,7 @@ static Object doGeneric(GraalHPyContext hpyContext, Object type, Object dataOutV
23252326

23262327
static PythonObject createFromBuiltinShape(int builtinShape, Object type, Object dataPtr, PythonObjectFactory factory) {
23272328
PythonObject result = switch (builtinShape) {
2328-
case HPyType_BUILTIN_SHAPE_OBJECT -> factory.createPythonHPyObject(type, dataPtr);
2329+
case HPyType_BUILTIN_SHAPE_LEGACY, HPyType_BUILTIN_SHAPE_OBJECT -> factory.createPythonHPyObject(type, dataPtr);
23292330
case HPyType_BUILTIN_SHAPE_TYPE -> throw CompilerDirectives.shouldNotReachHere("built-in shape type not yet implemented");
23302331
case HPyType_BUILTIN_SHAPE_LONG -> factory.createInt(type, BigInteger.ZERO);
23312332
case HPyType_BUILTIN_SHAPE_FLOAT -> factory.createFloat(type, 0.0);
@@ -2334,7 +2335,7 @@ static PythonObject createFromBuiltinShape(int builtinShape, Object type, Object
23342335
case HPyType_BUILTIN_SHAPE_LIST -> factory.createList(type);
23352336
default -> throw CompilerDirectives.shouldNotReachHere(INVALID_BUILT_IN_SHAPE);
23362337
};
2337-
if (builtinShape != HPyType_BUILTIN_SHAPE_OBJECT) {
2338+
if (builtinShape != HPyType_BUILTIN_SHAPE_LEGACY && builtinShape != HPyType_BUILTIN_SHAPE_OBJECT) {
23382339
GraalHPyData.setHPyNativeSpace(result, dataPtr);
23392340
}
23402341
return result;

0 commit comments

Comments
 (0)