Repository navigation
fix(livecodebench): support sys.stdout.buffer in output capture - #581
Open
mantuoluozk wants to merge 1 commit into
Open
mantuoluozk wants to merge 1 commit into
mantuoluozk wants to merge 1 commit into
Conversation
|
🚫 PR 合入质量检查未通过,PR 已被禁止合入。 未通过项:
请按上述提示整改后,重新推送(push)或评论本 PR 即可触发再次检查。 |
3 of 4 tasks
SJTUyh
reviewed
Oct 13, 2026
| from enum import Enum | ||
| # for capturing the stdout | ||
| from io import BytesIO, StringIO, TextIOWrapper | ||
| from io import BytesIO, TextIOWrapper |
Collaborator
There was a problem hiding this comment.
【review】 livecodebench是AISBench集成的第三方测试基准,AISBench没有权利随意更改livecodebench的evaluate的逻辑,同时修改评价逻辑会影响历史所有结果的复现,影响面过大,如果认为livecodebench的评价逻辑有问题请往上游社区提issue和PR https://github.com/livecodebench/livecodebench
Collaborator
There was a problem hiding this comment.
【review】如果https://github.com/livecodebench/livecodebench 上游社区有相同的issue,欢迎在AISBench仓库做同步修改
Author
There was a problem hiding this comment.
好的理解,上游livecodebench上次更新已经是去年了,issue和pr应该也不会有人处理,应该是不会修改了
This branch has not been deployed
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.
Fixes #579.
问题与修复
LiveCodeBench 执行模型生成的 Python 程序时,会用普通
StringIO替换sys.stdout。如果程序使用sys.stdout.buffer.write(...),就会抛出AttributeError,被判为运行错误。本 PR 使用由同一个
BytesIO支撑的TextIOWrapper捕获输出。文本写入和二进制写入共享底层流,因此可以保持写入顺序,并正确处理分多次写入的 UTF-8 字符。程序关闭sys.stdout后,判题器仍可读取已捕获的输出。本次只修改 stdout;
sys.stdin.buffer已由 #570 修复。相关的开放 PR 见 #518。验证
call_method调用路径。git diff --check通过。