aboutsummaryrefslogtreecommitdiff
path: root/py/mpz.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-10-11 13:00:56 +1100
committerDamien George <damien.p.george@gmail.com>2016-10-11 13:00:56 +1100
commitdf3e5d2b2f8610d246fea348bb96e70f636183ea (patch)
treec3ecd628d29df30bb0b718401a4c165240c749e6 /py/mpz.c
parent48874942f0e0c948a9cb351b25d9fb04cdb82d56 (diff)
py/mpz: Use assert to verify mpz does not have a fixed digit buffer.
Diffstat (limited to 'py/mpz.c')
-rw-r--r--py/mpz.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/py/mpz.c b/py/mpz.c
index b5ec171de..6415e1df4 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -734,11 +734,9 @@ STATIC void mpz_need_dig(mpz_t *z, mp_uint_t need) {
}
if (z->dig == NULL || z->alloc < need) {
- if (z->fixed_dig) {
- // cannot reallocate fixed buffers
- assert(0);
- return;
- }
+ // if z has fixed digit buffer there's not much we can do as the caller will
+ // be expecting a buffer with at least "need" bytes (but it shouldn't happen)
+ assert(!z->fixed_dig);
z->dig = m_renew(mpz_dig_t, z->dig, z->alloc, need);
z->alloc = need;
}