Skip to content

[SOT][Exception] Fix zerodiv not raising #73030

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 4 commits into from
Jun 4, 2025

Conversation

DrRyanHuang
Copy link
Contributor

@DrRyanHuang DrRyanHuang commented May 30, 2025

PR Category

Execute Infrastructure

PR Types

Bug fixes

Description

执行 fn:

def fn(x):
	1 / x

先执行 x=1 ,之后执行 x=0,并不会报错

这个PR将除数是否为0添加到 guard 中

PCard-66972
之前PR #72784 (comment) 的遗留问题

Copy link

paddle-bot bot commented May 30, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label May 30, 2025
self.assert_results(foo_mod, 10)
self.assert_exceptions(
ZeroDivisionError,
"integer (.)* modulo by zero",
Copy link
Contributor Author

@DrRyanHuang DrRyanHuang May 30, 2025

Choose a reason for hiding this comment

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

3.9和3.10 报错:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero

3.11 到 3.13 报错:

  File "<python-input-0>", line 1, in <module>
    3 % 0
    ~~^~~
ZeroDivisionError: integer modulo by zero

但是3.14报错:

Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    3 % 0
    ~~^~~
ZeroDivisionError: division by zero

TODO: 之后适配 3.14 要注意下

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow 🐾

@SigureMo SigureMo merged commit c3fb55c into PaddlePaddle:develop Jun 4, 2025
48 of 49 checks passed
@DrRyanHuang DrRyanHuang deleted the div_raise branch June 4, 2025 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants