huggingface / huggingface/Math-Verify

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

Open
#79 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.2k
Forks
60
PR merge metrics
No merged PRs in 30d

Description

### 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

```python
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

```text
AttributeError: Can't get local object 'timeout..decorator..wrapper..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:

```text
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.