Windows: parse/verify fail with timeout wrapper (AttributeError on local function pickling)

未关闭
#79 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@dexhunter 已经在做这个了。

开始于 2026年7月13日。

  • #80 来自 @dexhunter —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
python

调研方向

先从 math_verify.parse 和 math_verify.verify 使用的超时实现开始,然后在 Windows 上使用 Python 3.13 和 timeout_seconds=1 运行最小复现。跟踪 timeout wrapper 在 multiprocessing spawn 下是如何提交的。完成标准是:有效的 boxed 输入能够被解析,verify("4", "4", strict=True, timeout_seconds=1) 返回 True,并且失败不会被静默转换为空结果或假阴性。

由索引模型根据 Issue 内容生成。

描述

Summary

On Windows, math_verify.parse and math_verify.verify fail when timeout handling is enabled.
With default raise_on_error=False, failures are swallowed and parse returns [], which can
silently degrade correctness checks.

Environment
  • OS: Windows 11
  • Python: 3.13.3
  • math-verify: 0.9.0
Minimal Repro
import math_verify

print(math_verify.parse(r"\\boxed{4}", raise_on_error=True))
print(math_verify.verify("4", "4", strict=True, timeout_seconds=1, raise_on_error=True))
Observed
AttributeError: Can't get local object 'timeout.<locals>.decorator.<locals>.wrapper.<locals>.run_func'

When raise_on_error=False (default):

  • math_verify.parse(...) returns []
  • math_verify.verify(...) returns False

Related symptom sometimes appears from multiprocessing teardown on Windows:

OSError: [WinError 6] The handle is invalid
Expected
  • parse should return parsed candidates for valid boxed/math strings.
  • verify("4", "4", ...) should return True.
  • Timeout handling should work (or fail loudly with a clear platform-specific message), rather than
    silently returning empty parse results / false negatives.
Notes

The failure appears to be tied to the timeout implementation and Windows spawn multiprocessing,
where a local function used by the timeout wrapper is not picklable.

主要语言
Python
星标
1.2k
派生
67
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

huggingface/Math-Verify 的其他 Issue

查看 huggingface/Math-Verify 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。