torch._utils.ExceptionWrapper: fix for Exceptions with multiple args (#58131)
Summary:
Here's an example of what this PR should fix:
```
from torch._utils import ExceptionWrapper
class TwoArgException(Exception):
def __init__(self, msg, count): ...
# If you need a "real world" exception with two args, here's one from the stdlib:
# import asyncio
# TwoArgException = asyncio.exceptions.LimitOverrunError
# or if on Python 3.7, try:
# TwoArgException = asyncio.streams.LimitOverrunError
try:
raise TwoArgException("oh no", 0)
except Exception as e:
data = ExceptionWrapper(where="in a test case")
data.reraise()
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/58131
Reviewed By: heitorschueroff
Differential Revision: D29660248
Pulled By: ezyang
fbshipit-source-id: cbcecfee9cac183354542e147ee3d956038c8986