summaryrefslogtreecommitdiff
path: root/py/objexcept.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2020-07-02 13:56:09 -0700
committerGitHub <noreply@github.com>2020-07-02 13:56:09 -0700
commitc33542f978cc61f0466ff60ea769e3067baca95f (patch)
tree071e8f8a86971f7e947053c3b4fb2ff7da95d223 /py/objexcept.c
parentf572b723060382bbc9ca7a3edc88cb7c30fdcc30 (diff)
parenteec42d4cb53536a75e88f7f9321515bc6dcfeaa7 (diff)
Merge branch 'main' into patch-1
Diffstat (limited to 'py/objexcept.c')
-rw-r--r--py/objexcept.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/objexcept.c b/py/objexcept.c
index b7a536c5e..796be122f 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -400,7 +400,7 @@ mp_obj_t mp_obj_new_exception_msg_vlist(const mp_obj_type_t *exc_type, const com
// Try to allocate memory for the message
mp_obj_str_t *o_str = m_new_obj_maybe(mp_obj_str_t);
- size_t o_str_alloc = fmt->length + 1;
+ size_t o_str_alloc = decompress_length(fmt);
byte *o_str_buf = m_new_maybe(byte, o_str_alloc);
bool used_emg_buf = false;
@@ -433,7 +433,7 @@ mp_obj_t mp_obj_new_exception_msg_vlist(const mp_obj_type_t *exc_type, const com
// We have some memory to format the string
struct _exc_printer_t exc_pr = {!used_emg_buf, o_str_alloc, 0, o_str_buf};
mp_print_t print = {&exc_pr, exc_add_strn};
- char fmt_decompressed[fmt->length];
+ char fmt_decompressed[decompress_length(fmt)];
decompress(fmt, fmt_decompressed);
mp_vprintf(&print, fmt_decompressed, ap);
exc_pr.buf[exc_pr.len] = '\0';