Skip to content

[AUTOGENERATED] [release/2.13] fix PicklingError handling for Python 3.14 - #3586

Merged
rocm-repo-management-api-6[bot] merged 1 commit into
release/2.13from
autogenerated/release/2.13_cherry-pick_pr-3584
Aug 19, 2026
Merged

rocm-repo-management-api-6[bot] merged 1 commit into
release/2.13from
autogenerated/release/2.13_cherry-pick_pr-3584

Conversation

@rocm-repo-management-api-6

Copy link
Copy Markdown

Cherry-pick of #3584

Fix test_gather_object assertion for Python 3.14 PicklingError (pytorch#192811)
    
## Summary:
The test all_gather_objects a local class (unpicklable) and asserts an
error. The exception type changed: <=3.13 raised AttributeError, but
3.14
(CPython pytorchgh-139806) raises PicklingError from pickle.whichmodule() for
'<locals>' names. PicklingError is a PickleError, not an AttributeError,
so
the stale assertRaises(AttributeError) no longer matches.

Fix the assertion to (AttributeError, pickle.PickleError), correct
across
all supported versions (python_min_version = 3.10) while staying tight.
The
fix belongs in the test, not production: normalizing pickle's exception
type
in _object_to_tensor would mask a legitimate CPython change.

## Test plan:
Test Plan: on Python 3.14.4, assertRaises(AttributeError) around
pickle.Pickler().dump() of a local class ERRORS with PicklingError,
while
assertRaises((AttributeError, pickle.PickleError)) PASSES; on 3.10-3.13
the
real AttributeError is also matched (issubclass). Full test needs a
4-GPU
nccl world:
`pytest torch/testing/_internal/distributed/distributed_test.py -k
test_gather_object`

Authored with the assistance of an AI coding assistant.

Cherry-pick upstream pytorch#192811
@rocm-repo-management-api-6
rocm-repo-management-api-6 Bot merged commit 6596a0d into release/2.13 Aug 19, 2026
@rocm-repo-management-api-6
rocm-repo-management-api-6 Bot deleted the autogenerated/release/2.13_cherry-pick_pr-3584 branch August 19, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant