From fa1e6b91d72d9edd73ae5df18d2bb547fe0dcb5d Mon Sep 17 00:00:00 2001 From: Oleg Iarygin Date: Mon, 9 May 2022 17:27:01 +0300 Subject: [PATCH 1/3] Fix invalid call in pprint runned as a script --- Lib/pprint.py | 2 +- .../next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst diff --git a/Lib/pprint.py b/Lib/pprint.py index 575688d8eb6f4a..a7f13f51347608 100644 --- a/Lib/pprint.py +++ b/Lib/pprint.py @@ -643,7 +643,7 @@ def _perfcheck(object=None): object = [("string", (1, 2), [3, 4], {5: 6, 7: 8})] * 100000 p = PrettyPrinter() t1 = time.perf_counter() - p._safe_repr(object, {}, None, 0, True) + p._safe_repr(object, {}, None, 0) t2 = time.perf_counter() p.pformat(object) t3 = time.perf_counter() diff --git a/Misc/NEWS.d/next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst b/Misc/NEWS.d/next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst new file mode 100644 index 00000000000000..499d8375a98813 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst @@ -0,0 +1,2 @@ +Fix invalid :meth:`PrettyPrinter._safe_repr` call when :module:`pprint` is +runned as a script. From d54161d754a9fdb024c982bc201572e6c12938ca Mon Sep 17 00:00:00 2001 From: Oleg Iarygin Date: Mon, 9 May 2022 18:24:10 +0300 Subject: [PATCH 2/3] Fix the NEXT entry --- .../next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst b/Misc/NEWS.d/next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst index 499d8375a98813..320ee786387692 100644 --- a/Misc/NEWS.d/next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst +++ b/Misc/NEWS.d/next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst @@ -1,2 +1,2 @@ -Fix invalid :meth:`PrettyPrinter._safe_repr` call when :module:`pprint` is +Fix invalid :meth:`PrettyPrinter._safe_repr` call when :mod:`pprint` is runned as a script. From b766d7a27f750358912bb36928f7c4fd782690f9 Mon Sep 17 00:00:00 2001 From: Oleg Iarygin Date: Tue, 10 May 2022 19:08:31 +0300 Subject: [PATCH 3/3] Address the review --- .../next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst b/Misc/NEWS.d/next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst index 320ee786387692..d9b386a674a4f8 100644 --- a/Misc/NEWS.d/next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst +++ b/Misc/NEWS.d/next/Library/2022-05-09-17-31-30.gh-issue-92546.1hbeQQ.rst @@ -1,2 +1,2 @@ Fix invalid :meth:`PrettyPrinter._safe_repr` call when :mod:`pprint` is -runned as a script. +executed as a script.