Skip to content

Commit 8643007

Browse files
authored
Fix Numpy 2.0 compatibility bug in lesson 10 (#8381)
Numpy 2.0 no longer performs narrowing conversions automatically. We manually mask here instead. Fixes #8380
1 parent 6f650c6 commit 8643007

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python_bindings/tutorial/lesson_10_aot_compilation_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def main():
3131
input = np.empty((640, 480), dtype=np.uint8, order='F')
3232
for y in range(480):
3333
for x in range(640):
34-
input[x, y] = x ^ (y + 1)
34+
input[x, y] = (x ^ (y + 1)) & 0xFF
3535

3636
# And the memory where we want to write our output:
3737
output = np.empty((640, 480), dtype=np.uint8, order='F')

0 commit comments

Comments
 (0)