Allow numpy 2.3+ for Python 3.14 compatibility #409
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
~=2.1.0to>=2.1.0,<3to allow NumPy 2.3+Problem
NumPy 2.1.x has a bug on Python 3.14 where the "temporary elision" optimization incorrectly identifies arrays as temporary due to the new
LOAD_FAST_BORROWbytecode instruction, causing destructive in-place modifications during arithmetic operations.This caused
dividend_income_taxto return £0 instead of £22.55bn in UK microsimulations.Root Cause
When formulas execute operations like:
NumPy's temporary elision optimization checks
refcount==1to decide if it can do in-place ops. Python 3.14'sLOAD_FAST_BORROWbytecode creates temporary references that don't increment refcount, breaking this heuristic.Fix
Test plan
dividend_income_taxcorrectly returns £22.55bnCloses #407
🤖 Generated with Claude Code