gh-102840: Fix confused traceback when floordiv or mod operations happens between Fraction and complex objects#102842
Conversation
|
cc @skirpichev |
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
|
Also, I think there no need in |
|
@mdickinson (as a fraction expert) |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
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.
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.
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 <storchaka@gmail.com>
…ns happens between Fraction and complex objects (pythonGH-102842)
floordivormodhappens betweenFractionandcomplexobjects #102840