已关闭
[Bug-Report|缺陷反馈]: scripts/ Python 脚本使用 exit() 而非 sys.exit()(ruff PLR1722) #90
syy_3597创建于  8月17日关闭于  8月17日
syy_3597
8月17日 创建

Describe the current behavior / 问题描述 (Mandatory / 必填)

scripts/ 目录下 3 个 Python 脚本中共有 18 处使用内置 exit() 而非 sys.exit(),违反 ruff PLR1722 规则。

exit() 是交互式解释器的内置函数,不适合在脚本中使用(CPython 文档也建议用 sys.exit()),可能导致测试框架或 IDE 无法正确捕获退出状态。

涉及文件与行号:

scripts/build_util.py(13 处):行 38, 41, 44, 48, 128, 133, 144, 175, 191, 208, 213, 220, 223

scripts/compile_ascendc.py(2 处):行 320, 338

scripts/update_tbe_tactic_json.py(3 处):行 275, 310, 314

Environment / 环境信息 (Mandatory / 必填)

不涉及特定环境

Describe the expected behavior / 预期结果 (Mandatory / 必填)

将所有 exit(1) 替换为 sys.exit(1),并在使用 sys.exit() 的文件中确保已 import sys。

Special notes for this issue/备注 (Optional / 选填)

改动为纯文本替换,不影响功能逻辑。注意 scripts/build_util.py 当前未 import sys,需同步添加。

likedislike
east_yang成员
8月17日 评论:

已安排开发人员处理

likedislike
Eeast_yang成员
8月17日 将 east_yang 设为负责人
Ssyy_3597
8月17日 关联了pull request:fix: 修复 scripts/ 下 ruff 告警及 install_deps.sh dos2unix 问题
CANN-robotCANN-robot成员
8月17日 关闭了 issue
CANN-robotCANN-robot成员
8月17日 添加了label:resolved