mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Fix usages of contextmanager without finally (#96170)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/96170 Approved by: https://github.com/ngimel, https://github.com/malfet
This commit is contained in:
committed by
PyTorch MergeBot
parent
34d18c8bee
commit
5bbec680d7
@ -56,8 +56,10 @@ class SourceChangeWarning(Warning):
|
||||
@contextmanager
|
||||
def mkdtemp():
|
||||
path = tempfile.mkdtemp()
|
||||
yield path
|
||||
shutil.rmtree(path)
|
||||
try:
|
||||
yield path
|
||||
finally:
|
||||
shutil.rmtree(path)
|
||||
|
||||
|
||||
_package_registry = []
|
||||
|
Reference in New Issue
Block a user