Content-Length: 289664 | pFad | http://github.com/sympy/sympy/pull/27488

9B Fix infinite recursion error when vectors are defined incorrectly by RushabhMehta2005 · Pull Request #27488 · sympy/sympy · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix infinite recursion error when vectors are defined incorrectly #27488

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

RushabhMehta2005
Copy link
Contributor

References to other Issues or PRs

Fixes #27439

Brief description of what is fixed or changed

This PR addresses a bug where incorrectly defining a Vector caused an infinite recursion error.
The correct way to define a vector is documented in the [SymPy documentation](https://docs.sympy.org/latest/modules/vector/basics.html#coordinate-systems-and-vectors), as highlighted by @oscarbenjamin in [this comment](#27439 (comment)).

A regression test has been added to ensure this issue does not reoccur.

Other comments

Feedback and constructive criticism are highly appreciated! I am currently learning about SymPy and its codebase by tackling issues I can contribute to.

Release Notes

  • vector
    • Fixed a bug where incorrectly defining vectors caused an infinite recursion error.

@sympy-bot
Copy link

Hi, I am the SymPy bot. I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

Your release notes are in good order.

Here is what the release notes will look like:

  • vector

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.14.

Click here to see the pull request description that was parsed.
#### References to other Issues or PRs  
Fixes #27439  

#### Brief description of what is fixed or changed  
This PR addresses a bug where incorrectly defining a `Vector` caused an infinite recursion error.  
The correct way to define a vector is documented in the [[SymPy documentation](https://docs.sympy.org/latest/modules/vector/basics.html#coordinate-systems-and-vectors)](https://docs.sympy.org/latest/modules/vector/basics.html#coordinate-systems-and-vectors), as highlighted by @oscarbenjamin in [[this comment](https://github.com/sympy/sympy/issues/27439#issuecomment-2571602853)](https://github.com/sympy/sympy/issues/27439#issuecomment-2571602853).  

A regression test has been added to ensure this issue does not reoccur.  

#### Other comments  
Feedback and constructive criticism are highly appreciated! I am currently learning about SymPy and its codebase by tackling issues I can contribute to.  

#### Release Notes  

<!-- BEGIN RELEASE NOTES -->  
* vector  
  * Fixed a bug where incorrectly defining vectors caused an infinite recursion error.  
<!-- END RELEASE NOTES -->  

Comment on lines 275 to 276
except AttributeError:
raise ValueError("Wrong way of defining a vector.")
Copy link
Contributor

@Skylion007 Skylion007 Jan 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a very descriptive error message?

Suggested change
except AttributeError:
raise ValueError("Wrong way of defining a vector.")
except AttributeError as exc:
raise ValueError("Wrong way of defining a vector.") from exc

At least attach the exception cause

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error message has been improved and the exception cause has been attached now.

Thank you for taking the time to review my code!

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.

error in scalar multiplication of vectors
3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/sympy/sympy/pull/27488

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy