summaryrefslogtreecommitdiffstats
path: root/Lib/cProfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/cProfile.py')
-rwxr-xr-xLib/cProfile.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/cProfile.py b/Lib/cProfile.py
index f166a1c..c804504 100755
--- a/Lib/cProfile.py
+++ b/Lib/cProfile.py
@@ -110,6 +110,13 @@ class Profile(_lsprof.Profiler):
finally:
self.disable()
+ def __enter__(self):
+ self.enable()
+ return self
+
+ def __exit__(self, *exc_info):
+ self.disable()
+
# ____________________________________________________________
def label(code):