Fix make_trap dispatch passing a spurious self to bound methods#11
Open
zhaozhiwen wants to merge 1 commit into
Open
Fix make_trap dispatch passing a spurious self to bound methods#11zhaozhiwen wants to merge 1 commit into
zhaozhiwen wants to merge 1 commit into
Conversation
make_trap() called self.make_trap_from_right_angular_wedges(self, *params, lunit1) and self.make_trap_from_vertices(self, *params, lunit1). These are already-bound instance methods, so self is supplied automatically; the extra self (plus a positional lunit1) overflowed the parameter list and raised TypeError. The 4-param and 24-param trap constructors were completely broken; only the 11-param path worked. Drop the spurious self and pass the unit by keyword so it maps to the unit/lunit1 parameter rather than overflowing positionals. Verified: 4-param, 24-param, and 11-param make_trap() all build a G4Trap (the 4- and 24-param paths previously raised TypeError), with the length unit correctly applied (Python 3.12). Fixes gemc#5
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.
make_trap()calledself.make_trap_from_right_angular_wedges(self, *params, lunit1)andself.make_trap_from_vertices(self, *params, lunit1). These are already-bound instance methods, soselfis supplied automatically; the extraself(plus a positionallunit1) overflowed the parameter list and raisedTypeError. The 4-param and 24-param trap constructors were completely broken; only the 11-param path worked.Drop the spurious
selfand pass the unit by keyword (unit=/lunit1=).Validation: 4-param, 24-param, and 11-param
make_trap()all build aG4Trap(the 4- and 24-param paths previously raisedTypeError), with the length unit correctly applied (Python 3.12).Fixes #5