extmod/modubinascii: Update code, docs for hexlify now CPython has sep.

Since CPython 3.8 the optional "sep" argument to hexlify is officially
supported, so update comments in the code and the docs to reflect this.

Signed-off-by: Damien George <damien@micropython.org>
pull/6696/head
Damien George 2020-12-13 16:41:12 +11:00
rodzic 246b2e016a
commit 1719459c28
2 zmienionych plików z 6 dodań i 8 usunięć

Wyświetl plik

@ -14,13 +14,11 @@ Functions
.. function:: hexlify(data, [sep])
Convert binary data to hexadecimal representation. Returns bytes string.
Convert the bytes in the *data* object to a hexadecimal representation.
Returns a bytes object.
.. admonition:: Difference to CPython
:class: attention
If additional argument, *sep* is supplied, it is used as a separator
between hexadecimal values.
If the additional argument *sep* is supplied it is used as a separator
between hexadecimal values.
.. function:: unhexlify(data)

Wyświetl plik

@ -34,8 +34,8 @@
#if MICROPY_PY_UBINASCII
STATIC mp_obj_t mod_binascii_hexlify(size_t n_args, const mp_obj_t *args) {
// Second argument is for an extension to allow a separator to be used
// between values.
// First argument is the data to convert.
// Second argument is an optional separator to be used between values.
const char *sep = NULL;
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_READ);