summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/builtin_exec_buffer.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2020-02-28 12:45:36 +1100
committerDamien George <damien.p.george@gmail.com>2020-02-28 12:45:36 +1100
commit1993c8cf9af930cd6ff2f28390ac3a8a09d5b297 (patch)
tree84dbe9d016c9cc362c6deae0869b37cae4b64c6c /tests/basics/builtin_exec_buffer.py
parent54a54f5872ae489547f84600aab8471e6e83d715 (diff)
downloadmicropython-1993c8cf9af930cd6ff2f28390ac3a8a09d5b297.tar.gz
micropython-1993c8cf9af930cd6ff2f28390ac3a8a09d5b297.zip
py/builtinevex: Support passing in a bytearray/buffer to eval/exec.
CPython allows this and it's a simple generalisation of the existing code which just supported str/bytes. Fixes issue #5704.
Diffstat (limited to 'tests/basics/builtin_exec_buffer.py')
-rw-r--r--tests/basics/builtin_exec_buffer.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/basics/builtin_exec_buffer.py b/tests/basics/builtin_exec_buffer.py
new file mode 100644
index 0000000000..a875cfb1fa
--- /dev/null
+++ b/tests/basics/builtin_exec_buffer.py
@@ -0,0 +1,12 @@
+# test builtin exec with a buffer (bytearray/memoryview) input
+
+try:
+ exec
+ bytearray
+ memoryview
+except:
+ print("SKIP")
+ raise SystemExit
+
+exec(bytearray(b'print(1)'))
+exec(memoryview(b'print(2)'))