(gen0_threshold: Optional[int] = None)
| 877 | |
| 878 | @contextmanager |
| 879 | def customized_gc_thresholds(gen0_threshold: Optional[int] = None): |
| 880 | try: |
| 881 | if gen0_threshold: |
| 882 | gc.set_threshold(gen0_threshold) |
| 883 | logger.debug( |
| 884 | f'Set Python GC threshold to customized value: {gen0_threshold}' |
| 885 | ) |
| 886 | yield |
| 887 | finally: |
| 888 | if gen0_threshold: |
| 889 | gc.set_threshold(*PYTHON_DEFAULT_GC_THRESHOLDS) |
| 890 | logger.debug( |
| 891 | f'Reset Python GC thresholds to default value: {PYTHON_DEFAULT_GC_THRESHOLDS}' |
| 892 | ) |
| 893 | |
| 894 | |
| 895 | @contextmanager |
no test coverage detected