FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-102840: Fix confused traceback when `floordiv` or `mod` operations happens between `Fraction` and `complex` objects by Eclips4 · Pull Request #102842 · python/cpython · GitHub

Repository navigation

gh-102840: Fix confused traceback when floordiv or mod operations happens between Fraction and complex objects - #102842

Merged
serhiy-storchaka merged 10 commits into
python:mainfrom
Eclips4:issue-102840
Feb 10, 2024
Merged

serhiy-storchaka merged 10 commits into
python:mainfrom
Eclips4:issue-102840

Conversation

Eclips4 commented Mar 20, 2023 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

Eclips4 commented Mar 20, 2023

Copy link
Copy Markdown
Member Author

cc @skirpichev

Comment thread Lib/fractions.py Outdated
Comment thread Lib/fractions.py Outdated
Eclips4 requested a review from skirpichev March 20, 2023 12:36
Comment thread Lib/test/test_fractions.py Outdated
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>

Eclips4 commented Mar 20, 2023

Copy link
Copy Markdown
Member Author

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

skirpichev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

arhadthedev added the stdlib Standard Library Python modules in the Lib/ directory label Mar 22, 2023

Copy link
Copy Markdown
Member

@mdickinson (as a fraction expert)

Comment thread Lib/test/test_fractions.py Outdated

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Comment thread Lib/test/test_fractions.py Outdated
Comment thread Lib/test/test_fractions.py Outdated

Copy link
Copy Markdown
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 commented Feb 10, 2024

Copy link
Copy Markdown
Member Author

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

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Comment thread Lib/fractions.py Outdated
Comment thread Lib/test/test_fractions.py Outdated

skirpichev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, modulo minor nitpick about default value.

Comment thread Lib/fractions.py Outdated
…mnDq1.rst

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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
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

Labels

stdlib Standard Library Python modules in the Lib/ directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL