From 9162a87d4d21ce7f682e5d4ae7703fa1b13f45e9 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 29 Oct 2019 21:25:38 +1100 Subject: [PATCH] tests/basics: Use bytes not bytearray when checking user buffer proto. Using bytes will test the same path for the buffer protocol in py/objtype.c. --- tests/basics/class_misc.py | 2 +- tests/basics/subclass_native_buffer.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/basics/class_misc.py b/tests/basics/class_misc.py index 82b9b3479e..34b1a3bc64 100644 --- a/tests/basics/class_misc.py +++ b/tests/basics/class_misc.py @@ -4,6 +4,6 @@ class C: c = C() try: - d = bytearray(c) + d = bytes(c) except TypeError: print('TypeError') diff --git a/tests/basics/subclass_native_buffer.py b/tests/basics/subclass_native_buffer.py index 43c3819657..00717a70e7 100644 --- a/tests/basics/subclass_native_buffer.py +++ b/tests/basics/subclass_native_buffer.py @@ -12,5 +12,5 @@ print(b1 + b2) print(b1 + b3) print(b3 + b1) -# bytearray construction will use the buffer protocol -print(bytearray(b1)) +# bytes construction will use the buffer protocol +print(bytes(b1))