diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2021-07-13 18:01:12 +1000 |
---|---|---|
committer | Jim Mussared <jim.mussared@gmail.com> | 2022-08-12 12:44:30 +1000 |
commit | 28aaab95909aab092cc8c16188fec157142f18a9 (patch) | |
tree | 7792fc4fa68f9641da91fac41e824b78e17c2273 /py/objstr.h | |
parent | 6c67fbc280625c59fff7cdf93f16d5e2ad0bad8a (diff) |
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>
Diffstat (limited to 'py/objstr.h')
-rw-r--r-- | py/objstr.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/py/objstr.h b/py/objstr.h index 7d86ec30b..b1217d587 100644 --- a/py/objstr.h +++ b/py/objstr.h @@ -127,8 +127,15 @@ MP_DECLARE_CONST_FUN_OBJ_1(str_isupper_obj); MP_DECLARE_CONST_FUN_OBJ_1(str_islower_obj); MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(bytes_decode_obj); +mp_obj_t mp_obj_bytes_hex(size_t n_args, const mp_obj_t *args, const mp_obj_type_t *type); +mp_obj_t mp_obj_bytes_fromhex(mp_obj_t type_in, mp_obj_t data); + extern const mp_obj_dict_t mp_obj_str_locals_dict; +#if MICROPY_PY_BUILTINS_MEMORYVIEW && MICROPY_PY_BUILTINS_BYTES_HEX +extern const mp_obj_dict_t mp_obj_memoryview_locals_dict; +#endif + #if MICROPY_PY_BUILTINS_BYTEARRAY extern const mp_obj_dict_t mp_obj_bytearray_locals_dict; #endif |