Repository navigation
fix(numba): add TypingError fallback guards for unassigned variables in overloader methods (#512) - #766
Open
Hiak-Harsha wants to merge 2 commits into
Conversation
…in overloader methods (scikit-hep#512)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #766 +/- ##
==========================================
- Coverage 88.88% 88.85% -0.04%
==========================================
Files 96 96
Lines 10782 10786 +4
==========================================
Hits 9584 9584
- Misses 1198 1202 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Resolves #512.
In
src/vector/backends/_numba_object.py, several dispatch helper methods (add_binary_method,add_tolerance_method, andadd_isclose_method) register overloader functions containing conditional branches that assign return expressions (out = ...). In cases where an unsupported type combination is dispatched, these variables (out,result) could remain unbound before reaching the finalreturnstatement, triggering static analysis and Numba warnings:Possibly using variable 'out' before assignment (E0606).This PR adds explicit
raise numba.TypingError(...)fallback guards with descriptive error messages whenever unsupported argument type combinations are encountered, ensuring variables are never used before assignment and providing clear compile-time error feedback.Checklist
$ pre-commit run --all-filesor$ nox -s lint)$ pytestor$ nox -s tests)$ cd docs; make clean; make htmlor$ nox -s docs)$ pytest --doctest-plus src/vector/or$ nox -s doctests)Before Merging