Whole file
colcon/colcon-core
The author described this change as “Fix a regression in recursive dependency enumeration (#693)”. It counts as a record because the checks below fail on the code as it stood at 250164b8e and pass on afd1de18a, with nothing else changed between the two runs.
Projectcolcon/colcon-core
Fix saved2025-07-25
Sharing licenceApache-2.0 · LICENSE
Change size+7 −2
What the code was meant to do, written into the code itself as a save note
Fix a regression in recursive dependency enumeration (#693)
The change
| 8 | 8 | from pathlib import Path | |
| 9 | 9 | ||
| 10 | 10 | from colcon_core.dependency_descriptor import DependencyDescriptor | |
| 11 | + | from colcon_core.feature_flags import is_feature_flag_set | |
| 11 | 12 | ||
| 12 | 13 | ||
| 13 | 14 | class PackageDescriptor: | |
| ⋯ | |||
| 114 | 115 | :raises AssertionError: if a package lists itself as a dependency | |
| 115 | 116 | """ | |
| 116 | 117 | if not isinstance(recursive_categories, Mapping): | |
| 117 | - | recursive_categories = defaultdict(lambda: recursive_categories) | |
| 118 | + | non_map_categories = recursive_categories | |
| 119 | + | recursive_categories = defaultdict(lambda: non_map_categories) | |
| 118 | 120 | # the following variable only exists for faster access within the loop | |
| 119 | 121 | descriptors_by_name = defaultdict(set) | |
| 120 | 122 | for d in descriptors: | |
| ⋯ | |||
| 138 | 140 | continue | |
| 139 | 141 | categories = set() | |
| 140 | 142 | for category in dep.metadata['categories']: | |
| 141 | - | cats = recursive_categories.get(category) | |
| 143 | + | if is_feature_flag_set('restore_build_isolation'): | |
| 144 | + | cats = recursive_categories[category] | |
| 145 | + | else: | |
| 146 | + | cats = recursive_categories.get(category) | |
| 142 | 147 | if cats is None: | |
| 143 | 148 | categories = None | |
| 144 | 149 | break | |
The check that tells the two apart
fail→pass·test/test_package_descriptor.py::test_get_recursive_dependencies
fail→pass·test/test_package_descriptor.py::test_get_recursive_dependencies_map
Check file test/test_package_descriptor.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it250164b8e3a88497deb68d5168a11c5e7707a04f
Broken version dated2025-07-23
Modulecolcon_core.package_descriptor
Units changedPackageDescriptor
Fingerprintbaec56fe355bfaea
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in colcon/colcon-core
- 2024-05-24add_file_handler