mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 12:10:13 +01:00
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.
This commit is contained in:
12
tests/basics/builtin_eval_buffer.py
Normal file
12
tests/basics/builtin_eval_buffer.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# test builtin eval with a buffer (bytearray/memoryview) input
|
||||
|
||||
try:
|
||||
eval
|
||||
bytearray
|
||||
memoryview
|
||||
except:
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
print(eval(bytearray(b'1 + 1')))
|
||||
print(eval(memoryview(b'2 + 2')))
|
||||
Reference in New Issue
Block a user