@contextlib.contextmanager
def defer_cleanup():
 deallocs = current_context().deallocations
 with deallocs.disable():
  (yield)

@ contextlib . contextmanager def defer_cleanup ( ) : deallocs = current_context ( ) . deallocations with deallocs . disable ( ) : ( yield )
temporarily disable memory deallocation .