Skip to content

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

Merged
merged 10 commits into from
Feb 10, 2024

Conversation

Eclips4
Copy link
Member

@Eclips4 Eclips4 commented Mar 20, 2023

@Eclips4
Copy link
Member Author

Eclips4 commented Mar 20, 2023

cc @skirpichev

@Eclips4 Eclips4 requested a review from skirpichev March 20, 2023 12:36
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
@Eclips4
Copy link
Member Author

Eclips4 commented Mar 20, 2023

Also, I think there no need in NEWS entry. But if someone want it - I'll add it.

Copy link
Member

@skirpichev skirpichev left a comment

Choose a reason for hiding this comment

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

LGTM

@arhadthedev arhadthedev added the stdlib Python modules in the Lib dir label Mar 22, 2023
@arhadthedev
Copy link
Member

@mdickinson (as a fraction expert)

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a 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.

@mdickinson
Copy link
Member

I suggest to add an optional parameter in _operator_fallbacks() to specify whether try to handle complex numbers or not.

+1. This sounds like the right approach to me.

@Eclips4
Copy link
Member Author

Eclips4 commented Feb 10, 2024

Do we need NEWS entry here? It's improves the user experience, so in my opinion - yes.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a 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.

Copy link
Member

@skirpichev skirpichev left a 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.

…mnDq1.rst

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@serhiy-storchaka serhiy-storchaka merged commit 5319c66 into python:main Feb 10, 2024
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
scoder added a commit to scoder/quicktions that referenced this pull request Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants