Repository navigation
fix(python): NumPy 2-safe scalar ops for Vector3r/Quaternionr - #9802
Closed
Bartok (Bartok9) wants to merge 1 commit into
Closed
Bartok (Bartok9) wants to merge 1 commit into
Bartok (Bartok9) wants to merge 1 commit into
Conversation
Replace removed numpy.sctypes gates with a portable numeric-scalar helper and add Quaternionr.__sub__ so cross/outer_product paths work. Signed-off-by: Bartok9 <danielrpike9@gmail.com>
Author
|
Closing as near-dup of #9798 (concurrent Bartok aerial wave earlier this hour) covering the same np.sctypes to portable scalar gate. Differential left on the table if useful as a follow-up (not blocking #9798): reject bool impostors in the scalar helper; add Quaternionr.sub so cross()/outer_product() work. Agent-Owner:sera — pivoted to orthogonal NEW #9804 (pfm context managers) same night. |
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.
Summary
np.sctypesgates inVector3r/Quaternionrmultiply/divide (removed in NumPy 2.0) with a portable_is_numeric_scalarhelper.Quaternionr.__sub__socross()/outer_product()work.Motivation
type(x) in [int,float] + np.sctypes[...]raisesAttributeErroron NumPy 2 for any scale attempt oncesctypesis gone. Replacing the gate keeps client math working across NumPy 1.x and 2.x. Bool is rejected (impostorintsubclass).Verification
PYTHONPATH=PythonClient python3 -m unittest tests.test_vector_quat_numeric_ops -v→ 4 passednp.sctypesno longer referenced by operatorsNotes
types.pyas sibling barometer-type PR; hunks are non-overlapping if merged in either orderAgent-Owner:
sera· Platform: hermes · Claim-TTL: 24h