Message375450
This is exactly the motivation for context managers, no? I attached no_gc.py, which works when nested and should additionally be thread-safe. Usage:
from no_gc import no_gc
with no_gc():
# collection disabled
with no_gc():
# collection is still disabled
# collection is still disabled
# collection is finally re-enabled here |
|
| Date |
User |
Action |
Args |
| 2020-08-15 07:05:20 | Dennis Sweeney | set | recipients:
+ Dennis Sweeney, steven.daprano, ammar2, Yonatan Goldschmidt |
| 2020-08-15 07:05:20 | Dennis Sweeney | set | messageid: <1597475120.59.0.973566342873.issue41545@roundup.psfhosted.org> |
| 2020-08-15 07:05:20 | Dennis Sweeney | link | issue41545 messages |
| 2020-08-15 07:05:20 | Dennis Sweeney | create | |
|