From 04d5e644fcf4e0171383403e69d8fff429bba425 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 7 Apr 2016 09:03:33 +0100 Subject: py/objarray: Fix array.append so it doesn't extend if append fails. Addresses issue #1965. --- tests/basics/bytearray_append.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/basics/bytearray_append.py (limited to 'tests') diff --git a/tests/basics/bytearray_append.py b/tests/basics/bytearray_append.py new file mode 100644 index 000000000..06e62c6bc --- /dev/null +++ b/tests/basics/bytearray_append.py @@ -0,0 +1,15 @@ +# test bytearray.append method + +a = bytearray(4) +print(a) + +# append should append a single byte +a.append(2) +print(a) + +# a should not be modified if append fails +try: + a.append(None) +except TypeError: + print('TypeError') +print(a) -- cgit v1.2.3