Conversation
Replace the cryptic 'Not sure how you reached here' exception with an informative ValueError when the arc length is non-finite. This happens when the curve contains NaN/infinite points (e.g. a ParametricFunction evaluating to an invalid value), which makes the arc length undefined. Closes ManimCommunity#4838
for more information, see https://pre-commit.ci
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
Fixes #4838.
VMobject.point_from_proportionraised a crypticException("Not sure how you reached here, please file a bug report ...")when the mobject's arc length was non-finite. This happens when the curve contains NaN/infinite points (e.g. aParametricFunctionevaluating to an invalid value), which makes every curve length NaN, so the arc-length walk never reaches the target length and falls through to the cryptic error.Change
Replace the cryptic exception with an informative
ValueErrorthat reports the proportion, the target arc length, and the likely cause (NaN/infinite points).Test
Added
test_point_from_proportion_invalid_points_errorwhich builds aVMobjectwith a NaN corner and asserts the new informative error is raised.pytest tests/module/mobject/types/vectorized_mobject/test_vectorized_mobject.py -k point_from_proportion→ 3 passed.Notes
Disclosed: this change was authored with AI assistance (model deepseek/deepseek-v4-pro), reviewed by @webzuweb.