Commit 8865b7d4 authored by Benjamin Peterson's avatar Benjamin Peterson

add a contextmanager to disable the gc

parent e577ec9c
......@@ -1005,6 +1005,16 @@ def gc_collect():
gc.collect()
gc.collect()
@contextlib.contextmanager
def disable_gc():
have_gc = gc.isenabled()
gc.disable()
try:
yield
finally:
if have_gc:
gc.enable()
def python_is_optimized():
"""Find if Python was built with optimizations."""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment