process_map undercounts progress with chunksize > 1 in tqdm 4.70.0
Author: kartiksubbaraoCreated Aug 14, 2026Updated Aug 21, 2026
- I have marked all applicable categories:
- exception-raising bug
- visual output bug
- I have visited the source website, and in particular read the known issues
- I have searched through the issue tracker for duplicates
- I have mentioned version numbers, operating system and environment, where applicable:
Fedora 43
tqdm 4.70.0
Python 3.14.6 (main, Jun 11 2026, 00:00:00)
[GCC 15.2.1 20260123 (Red Hat 15.2.1-7)]
linuxI observed a progress-bar regression after upgrading from tqdm 4.69.1 to 4.70.0.
Here's an example:
from tqdm.contrib.concurrent import process_map
def f(x): return x
if __name__ == "__main__": process_map(f, range(101), chunksize=10)4.69.1 finishes correctly at 101/101 4.70.0 finishes incorrectly at 11/101.
I asked ChatGPT to investigate. It reproduced the issue on Python 3.13.5 and traced it to PR #1709, specifically this new callback:
fut.add_done_callback(lambda _: pbar.update())With process_map(..., chunksize=10), each Future represents a chunk of up to 10 input items. The callback therefore increments the bar once per chunk, while the total remains the number of items. For 101 items, ProcessPoolExecutor creates 11 chunks, so the bar ends at 11/101.
I can provide additional test details if that will help.
Source: tqdm/tqdm