Skip to content

Commit 313bea8

Browse files
dreissfacebook-github-bot
authored andcommitted
Remove _get_wrapped_func (#35621)
Summary: Pull Request resolved: #35621 Python 2 has reached end-of-life and is no longer supported by PyTorch. `func.__wrapped__` can be used directly in Python 3. Test Plan: CI Differential Revision: D20842875 Pulled By: dreiss fbshipit-source-id: 26f71df12db6d5118c8f278b27d747d647d07900
1 parent d060deb commit 313bea8

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

test/distributed/test_c10d.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2949,10 +2949,10 @@ def setUp(self):
29492949
# Need to skip return code checking for these tests since the child
29502950
# processes don't exit cleanly.
29512951
self.skip_return_code_checks = [
2952-
self._get_wrapped_func(self.test_nccl_errors_blocking_abort),
2953-
self._get_wrapped_func(self.test_nccl_errors_blocking_sigkill),
2954-
self._get_wrapped_func(self.test_nccl_errors_blocking_sigterm),
2955-
self._get_wrapped_func(self.test_nccl_errors_blocking_nonzero_exit),
2952+
self.test_nccl_errors_blocking_abort.__wrapped__,
2953+
self.test_nccl_errors_blocking_sigkill.__wrapped__,
2954+
self.test_nccl_errors_blocking_sigterm.__wrapped__,
2955+
self.test_nccl_errors_blocking_nonzero_exit.__wrapped__,
29562956
]
29572957
self._fork_processes()
29582958

@@ -2971,15 +2971,6 @@ def op_timeout_sec(self):
29712971
def world_size(self):
29722972
return 3
29732973

2974-
def _get_wrapped_func(self, func):
2975-
# Get the original function which was wrapped in the decorator.
2976-
if hasattr(func, '__wrapped__'):
2977-
# py3 way.
2978-
return func.__wrapped__
2979-
else:
2980-
# py2 way.
2981-
return func.func_closure[0].cell_contents
2982-
29832974
def _run_all_reduce(self, pg):
29842975
pg.allreduce(torch.rand(10).cuda(self.rank))
29852976

0 commit comments

Comments
 (0)