diff --git a/py/mpz.c b/py/mpz.c index 7f2b257673..1090d58c76 100644 --- a/py/mpz.c +++ b/py/mpz.c @@ -1677,7 +1677,7 @@ mp_float_t mpz_as_float(const mpz_t *i) { #if 0 this function is unused char *mpz_as_str(const mpz_t *i, mp_uint_t base) { - char *s = m_new(char, mpz_as_str_size(i, base, NULL, '\0')); + char *s = m_new(char, mp_int_format_size(mpz_max_num_bits(i), base, NULL, '\0')); mpz_as_str_inpl(i, base, NULL, 'a', '\0', s); return s; } diff --git a/py/mpz.h b/py/mpz.h index c792d87c56..1e91ca3304 100644 --- a/py/mpz.h +++ b/py/mpz.h @@ -137,7 +137,6 @@ void mpz_as_bytes(const mpz_t *z, bool big_endian, size_t len, byte *buf); #if MICROPY_PY_BUILTINS_FLOAT mp_float_t mpz_as_float(const mpz_t *z); #endif -size_t mpz_as_str_size(const mpz_t *i, mp_uint_t base, const char *prefix, char comma); size_t mpz_as_str_inpl(const mpz_t *z, mp_uint_t base, const char *prefix, char base_char, char comma, char *str); #endif // __MICROPY_INCLUDED_PY_MPZ_H__