diff options
author | Scott Sanderson <ssanderson@quantopian.com> | 2018-06-01 20:36:23 (GMT) |
---|---|---|
committer | Brett Cannon <brettcannon@users.noreply.github.com> | 2018-06-01 20:36:23 (GMT) |
commit | 2e01b75884892d5aabdaab658fbd17f7a7ccebaa (patch) | |
tree | 2f518fe2d3d32e398d5ddbf3d10681f2396f4e3c /Misc | |
parent | 252f6abe0a9430f4ae7588c0cb50a6ff141bebe3 (diff) | |
download | cpython-2e01b75884892d5aabdaab658fbd17f7a7ccebaa.zip cpython-2e01b75884892d5aabdaab658fbd17f7a7ccebaa.tar.gz cpython-2e01b75884892d5aabdaab658fbd17f7a7ccebaa.tar.bz2 |
bpo-29235: Make cProfile.Profile a context manager (GH-6808)
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2018-05-14-15-01-55.bpo-29235.47Fzwt.rst | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2018-05-14-15-01-55.bpo-29235.47Fzwt.rst b/Misc/NEWS.d/next/Library/2018-05-14-15-01-55.bpo-29235.47Fzwt.rst new file mode 100644 index 0000000..4618afc --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-05-14-15-01-55.bpo-29235.47Fzwt.rst @@ -0,0 +1,8 @@ +The :class:`cProfile.Profile` class can now be used as a context manager. +You can profile a block of code by running:: + + import cProfile + with cProfile.Profile() as profiler: + # ... code to be profiled ... + +Patch by Scott Sanderson. |