Skip to content

Conversation

@sobolevn
Copy link
Member

@sobolevnsobolevn commented May 15, 2024

Now these two errors are very similar:

>>>1//0Traceback (mostrecentcalllast): File"<python-input-0>", line1, in<module>1//0~~^^~~ZeroDivisionError: integerfloordivisionbyzero
>>>1.5//0Traceback (mostrecentcalllast): File"<python-input-1>", line1, in<module>1.5//0~~~~^^~~ZeroDivisionError: floatfloordivisionbyzero

Better wording is always welcome!


📚 Documentation preview 📚: https://cpython-previews--119066.org.readthedocs.build/

Copy link
Member

@mdickinsonmdickinson left a comment

Choose a reason for hiding this comment

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

The code changes look fine to me in principle. I think there's still some wrangling to do over the exact error messages we want - we need to resolve that on the issue.

@sobolevnsobolevn changed the title gh-119057: Use better error message for x // 0gh-119057: Use better error messages for zero divisionMay 16, 2024
@sobolevnsobolevn requested a review from mdickinsonJune 3, 2024 07:51
Copy link
Member

@mdickinsonmdickinson left a comment

Choose a reason for hiding this comment

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

LGTM - thank you! I searched for missing cases of both ZeroDivisionError and PyExc_ZeroDivisionError and didn't find any.

I'm a little horrified at how often we use ZeroDivisionError in random tests that have nothing to do with arithmetic, but that's another story ...

@sobolevn
Copy link
MemberAuthor

Thanks a lot for the help and review! 👍
Usually we don't backport error messages changes.

I will open a new issue about ZeroDivisionError refactor.

Sign up for freeto 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.

2 participants

@sobolevn@mdickinson