Skip to content

fix(numba): add TypingError fallback guards for unassigned variables in overloader methods (#512) - #766

Open
Hiak-Harsha wants to merge 2 commits into
scikit-hep:mainfrom
Hiak-Harsha:fix-numba-variable-assignment-warnings
Open

Hiak-Harsha wants to merge 2 commits into
scikit-hep:mainfrom
Hiak-Harsha:fix-numba-variable-assignment-warnings

Conversation

@Hiak-Harsha

Copy link
Copy Markdown

Description

Resolves #512.

In src/vector/backends/_numba_object.py, several dispatch helper methods (add_binary_method, add_tolerance_method, and add_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 final return statement, 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

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't any other open Pull Requests for the required change?
  • Does your submission pass pre-commit? ($ pre-commit run --all-files or $ nox -s lint)
  • Does your submission pass tests? ($ pytest or $ nox -s tests)
  • Does the documentation build with your changes? ($ cd docs; make clean; make html or $ nox -s docs)
  • Does your submission pass the doctests? ($ pytest --doctest-plus src/vector/ or $ nox -s doctests)

Before Merging

  • Summarize the commit messages into a brief review of the Pull request.

@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.85%. Comparing base (5e14d4d) to head (3195fea).

Files with missing lines Patch % Lines
src/vector/backends/_numba_object.py 0.00% 4 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possibly used before assignment pylint warning

1 participant