-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
gh-102840: Fix confused traceback when floordiv or mod operations happens between Fraction and complex objects
#102842
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
Conversation
|
cc @skirpichev |
Co-authored-by: Sergey B Kirpichev <[email protected]>
|
Also, I think there no need in |
skirpichev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@mdickinson (as a fraction expert) |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think that silencing TypeError for any operation is right. It can silence some unexpected errors, it is also not very efficient. It would be better to just not try to perform unsupported operation. I suggest to add an optional parameter in _operator_fallbacks() to specify whether try to handle complex numbers or not. We know which operations are not supported by complex.
+1. This sounds like the right approach to me. |
|
Do we need |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a user visible change, so a NEWS entry will not make bad.
It will help if users wonder about confusing error messages in older Python.
skirpichev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, modulo minor nitpick about default value.
Misc/NEWS.d/next/Library/2024-02-10-15-24-20.gh-issue-102840.4mnDq1.rst
Outdated
Show resolved
Hide resolved
…mnDq1.rst Co-authored-by: Serhiy Storchaka <[email protected]>
…ns happens between Fraction and complex objects (pythonGH-102842)
floordivormodhappens betweenFractionandcomplexobjects #102840