(root)
| 461 | |
| 462 | @contextlib.contextmanager |
| 463 | def chdir(root): |
| 464 | if root == ".": |
| 465 | yield |
| 466 | return |
| 467 | cwd = os.getcwd() |
| 468 | os.chdir(root) |
| 469 | try: |
| 470 | yield |
| 471 | except BaseException as exc: |
| 472 | raise exc |
| 473 | finally: |
| 474 | os.chdir(cwd) |
| 475 | |
| 476 | |
| 477 | def reliability_guard(maximum_memory_bytes: Optional[int] = None): |