27 lines
1.1 KiB
Diff
27 lines
1.1 KiB
Diff
From dc531ff24e6d073840a1ed3883c14b16f4c1e7fa Mon Sep 17 00:00:00 2001
|
|
From: Alex Reinking <areinking@adobe.com>
|
|
Date: Fri, 9 Aug 2024 10:54:54 -0400
|
|
Subject: [PATCH] Fix Numpy 2.0 compatibility bug in lesson 10
|
|
|
|
Numpy 2.0 no longer performs narrowing conversions
|
|
automatically. We manually mask here instead.
|
|
|
|
Fixes #8380
|
|
---
|
|
python_bindings/tutorial/lesson_10_aot_compilation_run.py | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/python_bindings/tutorial/lesson_10_aot_compilation_run.py b/python_bindings/tutorial/lesson_10_aot_compilation_run.py
|
|
index 1c3eb15d7da6..ef39e3411ec4 100644
|
|
--- a/python_bindings/tutorial/lesson_10_aot_compilation_run.py
|
|
+++ b/python_bindings/tutorial/lesson_10_aot_compilation_run.py
|
|
@@ -31,7 +31,7 @@ def main():
|
|
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)
|
|
+ input[x, y] = (x ^ (y + 1)) & 0xFF
|
|
|
|
# And the memory where we want to write our output:
|
|
output = np.empty((640, 480), dtype=np.uint8, order='F')
|