diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index b8b958883d67..2c24e4c314a7 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -920,7 +920,7 @@ def _determine_ext_objs(self, extobj: 'build.ExtractedObjects', proj_dir_to_buil if comp.language in LANGS_CANT_UNITY: sources += srcs continue - for i in range(len(srcs) // unity_size + 1): + for i in range((len(srcs) + unity_size - 1) // unity_size): _src = self.get_unity_source_file(extobj.target, comp.get_default_suffix(), i) sources.append(_src)