summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2023-10-12 15:45:40 +1100
committerDamien George <damien@micropython.org>2023-10-12 15:47:15 +1100
commit05cb1406ad1b421a238faf763e19f4119f5f6bb2 (patch)
tree837e3fd5f75e2c032b8efc808022ed5a176ce7ec /tests
parent5015779a6f4a180233a78ec8b5fd1ea095057a91 (diff)
extmod/moductypes: Validate that uctypes.struct addr argument is an int.
Fixes issue #12660. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/extmod/uctypes_error.py6
-rw-r--r--tests/extmod/uctypes_error.py.exp1
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/extmod/uctypes_error.py b/tests/extmod/uctypes_error.py
index d42956261..f8aea94a7 100644
--- a/tests/extmod/uctypes_error.py
+++ b/tests/extmod/uctypes_error.py
@@ -8,6 +8,12 @@ except ImportError:
data = bytearray(b"01234567")
+# first argument isn't an integer
+try:
+ uctypes.struct(data, {})
+except TypeError:
+ print("TypeError")
+
# del subscr not supported
S = uctypes.struct(uctypes.addressof(data), {})
try:
diff --git a/tests/extmod/uctypes_error.py.exp b/tests/extmod/uctypes_error.py.exp
index f2e9c12f7..9910ced6c 100644
--- a/tests/extmod/uctypes_error.py.exp
+++ b/tests/extmod/uctypes_error.py.exp
@@ -3,3 +3,4 @@ TypeError
TypeError
TypeError
TypeError
+TypeError