Repository navigation
fix: give a useful error when ProjectionClass*D is missing - #737
Merged
Saransh-cpp merged 6 commits intoSep 18, 2026
Merged
Conversation
If you build a subclass from the VectorAwkward mixins and don't give it a ProjectionClass3D/4D (like coffea's VertexArray, which intentionally has no 4D meaning), any operation that needs to promote the result blows up with a confusing AttributeError from awkward's field lookup that says nothing about what's actually missing. Route the ProjectionClass lookups in the awkward backend through a small helper that says which class is missing which attribute and what to do about it. Fixes scikit-hep#488
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #737 +/- ##
=======================================
Coverage 87.83% 87.84%
=======================================
Files 96 96
Lines 11236 11243 +7
=======================================
+ Hits 9869 9876 +7
Misses 1367 1367 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Saransh-cpp
approved these changes
Aug 8, 2026
Saransh-cpp
left a comment
Member
There was a problem hiding this comment.
Thanks a lot for working on this, @FanxinSun! As with your other PR: Please see #729 (comment) for my take on AI generated comments / code. I'll be happy to review this PR further if there is minimal AI usage (given that it is a good first issue).
ikrommyd
added a commit
to ikrommyd/vector
that referenced
this pull request
Sep 18, 2026
Brings in "rm typing_extension" (scikit-hep#743) and "give a useful error when ProjectionClass*D is missing" (scikit-hep#737). Conflict in src/vector/backends/awkward.py (`_wrap_result`, two hunks): both sides changed the same lines. This branch replaced the hand-written name tuples in the conditions with the shared `_temporal_fields` and `_longitudinal_fields` sets, and scikit-hep#737 replaced `cls.ProjectionClassND` in the bodies with `_projection_class(cls, N)`. The resolution keeps both: this branch's conditions with main's bodies. Assisted-by: ClaudeCode:claude-fable-5.1
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.
Closes #488.
If you build a vector subclass from the awkward mixins and don't give it a
ProjectionClass3D/4D(like coffea'sVertexArray, which intentionally has no 4D meaning), any operation that tries to promote the result currently dies with an unhelpfulAttributeErrorfrom awkward's field lookup, which says nothing about what's actually missing.This PR routes the
ProjectionClass*Dlookups in the awkward backend through a small helper that raises aTypeErrornaming the class, the missing attribute, and how to fix it:Also adds a regression test that builds a minimal mixin-only
Vertexbehavior the same way coffea does. Full awkward backend test file passes locally (51 passed).