Skip to content

Commit 279f4ee

Browse files
committed
Fix HPy test test_legacy_slots_fails_without_legacy
1 parent dde0b39 commit 279f4ee

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,6 +2000,9 @@ static Object doGeneric(GraalHPyContext context, Object typeSpec, Object typeSpe
20002000
// process legacy slots; this is of type 'cpy_PyTypeSlot legacy_slots[]'
20012001
Object legacySlots = callHelperFunctionNode.call(context, GraalHPyNativeSymbol.GRAAL_HPY_TYPE_SPEC_GET_LEGECY_SLOTS, typeSpec);
20022002
if (!ptrLib.isNull(legacySlots)) {
2003+
if (legacy == 0) {
2004+
throw raiseNode.raise(TypeError, "cannot specify .legacy_slots without setting .legacy=true");
2005+
}
20032006
int nLegacySlots = PInt.intValueExact(ptrLib.getArraySize(legacySlots));
20042007
for (int i = 0; i < nLegacySlots; i++) {
20052008
Object legacySlotDef = ptrLib.readArrayElement(legacySlots, i);

graalpython/lib-graalpython/modules/hpy/test/test_slots_legacy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ def test_legacy_slots_getsets(self):
257257
p = mod.Point()
258258
assert p.z == 2073
259259

260-
@pytest.mark.xfail
261260
def test_legacy_slots_fails_without_legacy(self):
262261
import pytest
263262
mod_src = """

0 commit comments

Comments
 (0)