From e134846c22ff06d9b52a3c0f580ef633d83dd057 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Fri, 1 Jun 2018 18:14:28 -0400 Subject: [PATCH 1/6] bpo-29235: Add versionadded note to cProfile docs. --- Doc/library/profile.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/profile.rst b/Doc/library/profile.rst index 5dc0b2f9405306..0f631664d0e582 100644 --- a/Doc/library/profile.rst +++ b/Doc/library/profile.rst @@ -272,6 +272,8 @@ functions: pr.print_stats() + .. versionadded:: 3.8 + .. method:: enable() Start collecting profiling data. From 9abe26d76a0957bfbaeca0de7baf4a3241fcbdea Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Fri, 1 Jun 2018 18:22:12 -0400 Subject: [PATCH 2/6] DOC: Remove extra paragraph from NEWS entry. xref: https://bugs.python.org/issue29235#msg318460 --- .../Library/2018-05-14-15-01-55.bpo-29235.47Fzwt.rst | 10 ++-------- 1 file changed, 2 insertions(+), 8 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 index 4618afc13ae08d..2ce9096126ab89 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. From 8fb015782727304bcd509f587000b23cebb233f4 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Fri, 1 Jun 2018 18:23:07 -0400 Subject: [PATCH 3/6] DOC: Add whatsnew entry for bpo-29235. --- Doc/whatsnew/3.8.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index 9aad908f927f84..444684e027a912 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 :issue:`29235`.) CPython bytecode changes ------------------------ From 4b8b7436b1d49f48a151358c1c94952cabcaa6b3 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Sat, 2 Jun 2018 15:19:54 -0400 Subject: [PATCH 4/6] Add missing word. --- Doc/whatsnew/3.8.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index 444684e027a912..52c762632647c7 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -152,7 +152,7 @@ Changes in the Python API 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 :issue:`29235`.) + manager. (Contributed by Scott Sanderson in :issue:`29235`.) CPython bytecode changes ------------------------ From 84bed5556fc1800f8debb7bbe19de293ce09a0e2 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Sun, 3 Jun 2018 12:09:57 -0400 Subject: [PATCH 5/6] DOC: Switch from versionadded to versionchanged. --- Doc/library/profile.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/library/profile.rst b/Doc/library/profile.rst index 0f631664d0e582..4dadf9dce8b558 100644 --- a/Doc/library/profile.rst +++ b/Doc/library/profile.rst @@ -272,8 +272,9 @@ functions: pr.print_stats() - .. versionadded:: 3.8 - + .. versionchanged:: 3.8 + Added context manager support. + .. method:: enable() Start collecting profiling data. From 7f32b196d18660079cdaafbe6ac001de2618efd8 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Sun, 3 Jun 2018 12:14:34 -0400 Subject: [PATCH 6/6] DOC: Remove extra whitespace. --- Doc/library/profile.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/profile.rst b/Doc/library/profile.rst index 4dadf9dce8b558..beb77f38649410 100644 --- a/Doc/library/profile.rst +++ b/Doc/library/profile.rst @@ -274,7 +274,7 @@ functions: .. versionchanged:: 3.8 Added context manager support. - + .. method:: enable() Start collecting profiling data.