Skip to content

GraalPy doesn't raise OverflowError when CPython does #570

@kgonia

Description

@kgonia

I was trying to build cffi wheel with GraalPy, but tests are failing on GraalPy because of an inconsistency with the CPython implementation. The code below raises an OverflowError with CPython but doesn't with GraalPy.

import pytest
import sys

from _cffi_backend import new_primitive_type, new_pointer_type, new_array_type


def test_graalpy_overflow_behavior_on_large_array_size():
    """
    This test asserts that creating an array type with a size larger than
    sys.maxsize raises an OverflowError.

    Expected behavior:
    - CPython: Should raise OverflowError. Test will PASS.
    - GraalPy: Should NOT raise OverflowError. Test will FAIL.
    """
    p = new_primitive_type("int")
    
    pytest.raises(OverflowError, new_array_type, new_pointer_type(p), sys.maxsize + 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions