diff options
author | Jeff Epler <jepler@gmail.com> | 2025-06-01 19:19:51 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-06-10 15:32:54 +1000 |
commit | 0a98f3a91130d127c937d6865ead24b6693182eb (patch) | |
tree | 81389ca5b294044edb3bbbdac7de5d544f818f94 /tests/basics/array_add.py | |
parent | c1629dc2ff12a92d600b5988827566f8d693cad1 (diff) |
py/objarray: Allow extending array with any iterable.
As suggested by @dpgeorge, factor out part of array_construct to allow it
to be used for construction & extension.
Note that extending with a known-length list (or tuple) goes through the
slow path of calling array_extend once per element.
Fixes issue #7408.
Signed-off-by: Jeff Epler <jepler@gmail.com>
Diffstat (limited to 'tests/basics/array_add.py')
-rw-r--r-- | tests/basics/array_add.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/basics/array_add.py b/tests/basics/array_add.py index 76ce59f76..e78615541 100644 --- a/tests/basics/array_add.py +++ b/tests/basics/array_add.py @@ -14,3 +14,9 @@ print(a1) a1.extend(array.array('I', [5])) print(a1) + +a1.extend([6, 7]) +print(a1) + +a1.extend(i for i in (8, 9)) +print(a1) |