PyTorch Dynamo skips unsupported CPython closure tests in PR #183974
PR #183974 removes false failures from Dynamo's test suite.
PyTorch's Dynamo compiler has a new cleanup merge: PR #183974, submitted by anijain2305 and authored by Codex. The patch skips CPython test cases that define local classes whose methods close over mutable objects. Such patterns depend on the `__build_class__` function, which occurs when a class definition is executed inside a function—Dynamo lacks support for this. Previously, these tests triggered expected-failure markers. Now, the tests are simply skipped under Dynamo, removing unnecessary noise in the test suite.
This change is minor but important for maintaining a clean codebase. By removing false negatives and expected failures, developers working on PyTorch's graph capture system can focus on genuine issues. It also highlights ongoing work to align Dynamo with CPython's semantics, a key challenge for any Python JIT compiler. The approval by guilhermeleobas ensures the fix is consistent with Dynamo's design.
- PR #183974 skips CPython closure tests using unsupported `__build_class__` pattern
- Dynamo does not support closures over mutable objects in local class definitions
- Removes expected-failure markers, reducing test noise for PyTorch developers
Why It Matters
Cleaner test suite helps PyTorch developers catch real bugs faster in their ML pipelines.