1
0
Fork 0
mirror of synced 2024-12-22 14:11:07 -05:00

Merge branch 'kurtmckee/fix-patch-stop-order-i...'

This commit is contained in:
Anish Athalye 2024-12-18 19:35:46 -08:00
commit 82834e66ca

View file

@ -217,7 +217,9 @@ def root(standardize_tmp):
try:
yield current_root
finally:
[patch.stop() for patch in patches]
# Patches must be stopped in reverse order because some patches are nested.
# Stopping in the reverse order restores the original function.
[patch.stop() for patch in reversed(patches)]
os.chdir(current_working_directory)
if sys.version_info >= (3, 12):
rmtree(current_root, onexc=rmtree_error_handler)