Skip to content

Commit df3e5d2

Browse files
committed
py/mpz: Use assert to verify mpz does not have a fixed digit buffer.
1 parent 4887494 commit df3e5d2

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

py/mpz.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -734,11 +734,9 @@ STATIC void mpz_need_dig(mpz_t *z, mp_uint_t need) {
734734
}
735735

736736
if (z->dig == NULL || z->alloc < need) {
737-
if (z->fixed_dig) {
738-
// cannot reallocate fixed buffers
739-
assert(0);
740-
return;
741-
}
737+
// if z has fixed digit buffer there's not much we can do as the caller will
738+
// be expecting a buffer with at least "need" bytes (but it shouldn't happen)
739+
assert(!z->fixed_dig);
742740
z->dig = m_renew(mpz_dig_t, z->dig, z->alloc, need);
743741
z->alloc = need;
744742
}

0 commit comments

Comments
 (0)