File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -272,6 +272,9 @@ functions:
272
272
273
273
pr.print_stats()
274
274
275
+ .. versionchanged :: 3.8
276
+ Added context manager support.
277
+
275
278
.. method :: enable()
276
279
277
280
Start collecting profiling data.
Original file line number Diff line number Diff line change @@ -151,6 +151,8 @@ Changes in the Python API
151
151
``type.__new__ ``. A :exc: `DeprecationWarning ` was emitted in Python
152
152
3.6--3.7. (Contributed by Serhiy Storchaka in :issue: `23722 `.)
153
153
154
+ * The :class: `cProfile.Profile ` class can now be used as a context
155
+ manager. (Contributed by Scott Sanderson in :issue: `29235 `.)
154
156
155
157
CPython bytecode changes
156
158
------------------------
Original file line number Diff line number Diff line change 1
- The :class: `cProfile.Profile ` class can now be used as a context manager.
2
- You can profile a block of code by running::
3
-
4
- import cProfile
5
- with cProfile.Profile() as profiler:
6
- # ... code to be profiled ...
7
-
8
- Patch by Scott Sanderson.
1
+ The :class: `cProfile.Profile ` class can now be used as a context manager. Patch
2
+ by Scott Sanderson.
You can’t perform that action at this time.
0 commit comments