fix(core): make abatch_iterate consistent with batch_iterate for None and zero size (#39367)