summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Sanderson <ssanderson@quantopian.com>2018-06-07 09:46:42 (GMT)
committerINADA Naoki <methane@users.noreply.github.com>2018-06-07 09:46:42 (GMT)
commitcebe80b59b7386db3cce904d280dab61d1037e7a (patch)
tree5565600350aead9bc48139ff28562e870894a0d0
parentfffeb6f3d66f1c844a9327ffe6e2ad8eae8aeb14 (diff)
downloadcpython-cebe80b59b7386db3cce904d280dab61d1037e7a.zip
cpython-cebe80b59b7386db3cce904d280dab61d1037e7a.tar.gz
cpython-cebe80b59b7386db3cce904d280dab61d1037e7a.tar.bz2
bpo-29235: Update document for Profiler's context manager (GH-7331)
-rw-r--r--Doc/library/profile.rst3
-rw-r--r--Doc/whatsnew/3.8.rst2
-rw-r--r--Misc/NEWS.d/next/Library/2018-05-14-15-01-55.bpo-29235.47Fzwt.rst10
3 files changed, 7 insertions, 8 deletions
diff --git a/Doc/library/profile.rst b/Doc/library/profile.rst
index 7b60426..5e33efe 100644
--- a/Doc/library/profile.rst
+++ b/Doc/library/profile.rst
@@ -272,6 +272,9 @@ functions:
pr.print_stats()
+ .. versionchanged:: 3.8
+ Added context manager support.
+
.. method:: enable()
Start collecting profiling data.
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index 9aad908..52c7626 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -151,6 +151,8 @@ Changes in the Python API
``type.__new__``. A :exc:`DeprecationWarning` was emitted in Python
3.6--3.7. (Contributed by Serhiy Storchaka in :issue:`23722`.)
+* The :class:`cProfile.Profile` class can now be used as a context
+ manager. (Contributed by Scott Sanderson in :issue:`29235`.)
CPython bytecode changes
------------------------
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
index 4618afc..2ce9096 100644
--- 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
@@ -1,8 +1,2 @@
-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.
+The :class:`cProfile.Profile` class can now be used as a context manager. Patch
+by Scott Sanderson.