Dennis Sweeney <sweeney.dennis...@gmail.com> added the comment:
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 ---------- nosy: +Dennis Sweeney Added file: https://bugs.python.org/file49394/no_gc.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41545> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com