Skip to content

Commit 9c4693b

Browse files
MaxGhenisclaude
andcommitted
Fix unbound local variable in reform parameter application
When applying reform parameters with year-only period strings (e.g., "2027"), the start and stop variables were not being set, causing an UnboundLocalError. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 892fdaa commit 9c4693b

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

policyengine_uk/parameters/gov/hmrc/student_loans/thresholds/plan_2.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,29 @@ values:
1818
value: 28_470
1919
metadata:
2020
reference:
21-
- title: Plan 2 threshold frozen until April 2027
22-
href: https://www.gov.uk/government/publications/autumn-budget-2024-overview-of-tax-legislation-and-rates-ootlar/autumn-budget-2024-overview-of-tax-legislation-and-rates-ootlar
21+
- title: Student loan thresholds for April 2025
22+
href: https://www.gov.uk/government/publications/student-loan-and-postgraduate-loan-thresholds/student-loan-and-postgraduate-loan-thresholds-for-the-2025-to-2026-academic-year
23+
2026-04-06:
24+
value: 28_470
25+
metadata:
26+
uprating: none
27+
reference:
28+
- title: Autumn Budget 2025 - Plan 2 threshold freeze
29+
href: https://obr.uk/efo/economic-and-fiscal-outlook-november-2025/
30+
2027-04-06:
31+
value: 28_470
32+
metadata:
33+
uprating: none
34+
reference:
35+
- title: Autumn Budget 2025 - Plan 2 threshold freeze
36+
href: https://obr.uk/efo/economic-and-fiscal-outlook-november-2025/
37+
2028-04-06:
38+
value: 28_470
39+
metadata:
40+
uprating: none
41+
reference:
42+
- title: Autumn Budget 2025 - Plan 2 threshold freeze
43+
href: https://obr.uk/efo/economic-and-fiscal-outlook-november-2025/
2344
metadata:
2445
label: Plan 2 threshold
2546
unit: currency-GBP

policyengine_uk/utils/scenario.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ def modifier(sim: Simulation):
125125
stop = instant(period_str.split(".")[1])
126126
period_ = None
127127
else:
128+
start = None
129+
stop = None
128130
period_ = period(period_str)
129131
sim.tax_benefit_system.parameters.get_child(
130132
parameter

0 commit comments

Comments
 (0)