py/objstr: Add hex/fromhex to bytes/memoryview/bytearray.

These were added in Python 3.5.

Enabled via MICROPY_PY_BUILTINS_BYTES_HEX, and enabled by default for all
ports that currently have ubinascii.

Rework ubinascii to use the implementation of these methods.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared
2021-07-13 18:01:12 +10:00
parent 6c67fbc280
commit 28aaab9590
13 changed files with 138 additions and 70 deletions

View File

@@ -56,6 +56,7 @@
#define MICROPY_MODULE_WEAK_LINKS (1)
// Control over Python builtins
#define MICROPY_PY_ASYNC_AWAIT (0)
#define MICROPY_PY_BUILTINS_BYTES_HEX (1)
#define MICROPY_PY_BUILTINS_STR_COUNT (0)
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
#define MICROPY_PY_BUILTINS_SET (0)