'Replace the payload with a new empty payload with the given number
of entries.
CAUTION: *nentries* must be a power of 2!'

def _replace_payload(self, nentries):

    context = self._context
    builder = self._builder
    self._free_payload(self.payload.ptr)
    ok = self._allocate_payload(nentries, realloc=True)
    with builder.if_then(builder.not_(ok), likely=False):
        context.call_conv.return_user_exc(builder, MemoryError, ('cannot    reallocate    set',))
