Whole file
sanic-org/sanic-routing
The author described this change as “Resolve requirements conditional bug (#6)”. It counts as a record because the check below fails on the code as it stood at 929925ba9 and passes on 0691e9f33, with nothing else changed between the two runs.
Projectsanic-org/sanic-routing
Fix saved2021-03-04
Sharing licenceMIT · LICENSE
Change size+2 −2
What the code was meant to do, written into the code itself as a save note
Resolve requirements conditional bug (#6)
The change
| 156 | 156 | self._children[child.part] = child | |
| 157 | 157 | ||
| 158 | 158 | def _inject_requirements(self, location, indent): | |
| 159 | - | for idx, reqs in self.route.requirements.items(): | |
| 160 | - | conditional = "if" if idx == 0 else "elif" | |
| 159 | + | for k, (idx, reqs) in enumerate(self.route.requirements.items()): | |
| 160 | + | conditional = "if" if k == 0 else "elif" | |
| 161 | 161 | location.extend( | |
| 162 | 162 | [ | |
| 163 | 163 | Line((f"{conditional} extra == {reqs}:"), indent), |
The check that tells the two apart
fail→pass·tests/test_routing.py::test_conditional_check_proper_compile
Check file tests/test_routing.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 it929925ba96743a0c01217f2c346dfa528dfdfd64
Broken version dated2021-02-28
Modulesanic_routing.tree
Units changedNode
Fingerprint462f66a182b53bd5
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.