(root)
| 643 | |
| 644 | @contextlib.contextmanager |
| 645 | def chdir(root): |
| 646 | if root == ".": |
| 647 | yield |
| 648 | return |
| 649 | cwd = os.getcwd() |
| 650 | os.chdir(root) |
| 651 | try: |
| 652 | yield |
| 653 | except BaseException as exc: |
| 654 | raise exc |
| 655 | finally: |
| 656 | os.chdir(cwd) |
| 657 | |
| 658 | |
| 659 | def reliability_guard(maximum_memory_bytes: Optional[int] = None): |