Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid throwing exception in ClosingTHPObjectPtr (pytorch#109758)
Previously, if ClosingTHPObjectPtr was destructed because we were unwinding the stack from an exception, we would attempt to call close() which just isn't going to work. Two fixes: 1. Detect if we're unwinding due to a Python error, and don't try to do more Python stuff if so. 2. If close() fails somehow, write an unraisable exception, don't try to throw because that will terminate if you're in an exception. Signed-off-by: Edward Z. Yang <[email protected]> Pull Request resolved: pytorch#109758 Approved by: https://github.com/jansel
- Loading branch information