Repository navigation
fix: PNG 裁剪失败时回退到未裁剪图片 - #704
Merged
Merged
Conversation
将 PNG 转换从 check_call 改为可检查返回值的 call;转换失败或裁剪器不可用时删除不完整输出,并走已有的未裁剪图片回退逻辑。
测试新的回退行为:裁剪命令返回非零时保存未裁剪图片,而不是抛出异常。
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
当前
PR Build在test_plot_utils_save_fallback中稳定失败:plot_utils.save_fig的 PNG 分支使用subprocess.check_call,裁剪命令返回非零状态时会直接抛出异常,导致后面的“保存未裁剪图片”回退逻辑无法执行。该失败在多个 PR 的 CI 中都能复现,与具体文档改动无关。
修复
subprocess.call。OSError,继续走回退逻辑。shutil.copy2未裁剪图片回退和警告日志。验证
测试通过:
Ran 1 test ... OK。影响
docs/src/python/plot_utils.py。