Skip to content

python_tutorial_lesson_10_aot_compilation_run incompatible with Numpy 2 #8380

@alexreinking

Description

@alexreinking

Numpy no longer automatically truncates Python integers to the destination type. So the following code causes an overflow error now:

    input = np.empty((640, 480), dtype=np.uint8, order='F')
    for y in range(480):
        for x in range(640):
            input[x, y] = x ^ (y + 1)

We can recover the old behavior by manually masking.

    input = np.empty((640, 480), dtype=np.uint8, order='F')
    for y in range(480):
        for x in range(640):
            input[x, y] = (x ^ (y + 1)) & 0xFF

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