Skip to content

bpo-41546: make pprint (like print) not write to stdout when it is None - #26810

Merged
iritkatriel merged 7 commits into
python:mainfrom
iritkatriel:bpo-41546
Jul 19, 2021
Merged

bpo-41546: make pprint (like print) not write to stdout when it is None#26810
iritkatriel merged 7 commits into
python:mainfrom
iritkatriel:bpo-41546

Conversation

@iritkatriel

@iritkatrieliritkatriel commented Jun 20, 2021

Copy link
Copy Markdown
Member

@iritkatrieliritkatriel changed the title bpo-41546: pprint (like print) does not write to stdout when it is Nonebpo-41546: make pprint (like print) not write to stdout when it is NoneJun 20, 2021
@iritkatriel
iritkatriel requested a review from zoobaJune 20, 2021 14:03
Comment threadLib/pprint.py Outdated
@iritkatriel

Copy link
Copy Markdown
MemberAuthor

Any more comments before I merge?

@serhiy-storchakaserhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document the change.

Comment threadLib/test/test_pprint.py Outdated
Comment on lines 252 to 254

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not it already tested in test_stdout_is_None?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, this is no longer needed, I'll remove. With my first (more complex) solution this covered more code paths.

@serhiy-storchaka

Copy link
Copy Markdown
Member

Please document this behavior in the module documentation and add the versionchanged directive.

@iritkatriel

Copy link
Copy Markdown
MemberAuthor

Please document this behavior in the module documentation and add the versionchanged directive.

Done.

Probably not part of this PR, but I don't think the doc needs to repeat this twice. Could we not refer from pprint()'s doc to PrettyPrinter.pprint()'s doc?

@serhiy-storchakaserhiy-storchaka added the type-feature A feature request or enhancement label Jul 3, 2021
@serhiy-storchaka

Copy link
Copy Markdown
Member

Why not in this PR?

@iritkatriel

Copy link
Copy Markdown
MemberAuthor

Why not in this PR?

Sure, if you don't mind mixing two celebrations.

@iritkatriel

Copy link
Copy Markdown
MemberAuthor

Why not in this PR?

Sure, if you don't mind mixing two celebrations.

@serhiy-storchaka I've made the doc change, let me know if it looks ok.

Comment threadDoc/library/pprint.rst Outdated
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Added the *sort_dicts* parameter.

.. versionchanged:: 3.10
Added the *underscore_numbers* parameter.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove versionchanged notes? People need to know this.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're removing the repetitions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But these are not needless repetitions: they are separate notes on separate functions.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We removed repetition not only of the version labels but also of the definitions they relate to, and we replaced them by a reference to where those definitions appear (once).

It is easier read the docs when they are not repetitive because then you know that A is the same as B, and you don't need to do the work to compare them just to find that out.

@iritkatriel
iritkatriel merged commit aab1899 into python:mainJul 19, 2021
@bedevere-bot

bedevere-bot commented Jul 19, 2021

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot PPC64 Fedora 3.x has failed when building commit aab1899.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/237/builds/560) and take a look at the build logs.
  4. Check if the failure is related to this commit (aab1899) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/237/builds/560

Summary of the results of the build (if available):

Click to see traceback logs
remote: Enumerating objects: 26, done.�[Kremote: Counting objects: 3% (1/26)�[Kremote: Counting objects: 7% (2/26)�[Kremote: Counting objects: 11% (3/26)�[Kremote: Counting objects: 15% (4/26)�[Kremote: Counting objects: 19% (5/26)�[Kremote: Counting objects: 23% (6/26)�[Kremote: Counting objects: 26% (7/26)�[Kremote: Counting objects: 30% (8/26)�[Kremote: Counting objects: 34% (9/26)�[Kremote: Counting objects: 38% (10/26)�[Kremote: Counting objects: 42% (11/26)�[Kremote: Counting objects: 46% (12/26)�[Kremote: Counting objects: 50% (13/26)�[Kremote: Counting objects: 53% (14/26)�[Kremote: Counting objects: 57% (15/26)�[Kremote: Counting objects: 61% (16/26)�[Kremote: Counting objects: 65% (17/26)�[Kremote: Counting objects: 69% (18/26)�[Kremote: Counting objects: 73% (19/26)�[Kremote: Counting objects: 76% (20/26)�[Kremote: Counting objects: 80% (21/26)�[Kremote: Counting objects: 84% (22/26)�[Kremote: Counting objects: 88% (23/26)�[Kremote: Counting objects: 92% (24/26)�[Kremote: Counting objects: 96% (25/26)�[Kremote: Counting objects: 100% (26/26)�[Kremote: Counting objects: 100% (26/26), done.�[Kremote: Compressing objects: 7% (1/14)�[Kremote: Compressing objects: 14% (2/14)�[Kremote: Compressing objects: 21% (3/14)�[Kremote: Compressing objects: 28% (4/14)�[Kremote: Compressing objects: 35% (5/14)�[Kremote: Compressing objects: 42% (6/14)�[Kremote: Compressing objects: 50% (7/14)�[Kremote: Compressing objects: 57% (8/14)�[Kremote: Compressing objects: 64% (9/14)�[Kremote: Compressing objects: 71% (10/14)�[Kremote: Compressing objects: 78% (11/14)�[Kremote: Compressing objects: 85% (12/14)�[Kremote: Compressing objects: 92% (13/14)�[Kremote: Compressing objects: 100% (14/14)�[Kremote: Compressing objects: 100% (14/14), done.�[Kremote: Total 14 (delta 12), reused 1 (delta 0), pack-reused 0�[K
From https://github.com/python/cpython
* branch main -> FETCH_HEAD
Note: checking out 'aab1899c9d79083c1ff31d974ed8b562d3ca3b5d'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at aab1899... [bpo-41546](https://bugs.python.org/issue41546): make pprint (like print) not write to stdout when it is None (GH-26810)
Switched to and reset branch 'main'
./configure: line 10530: PKG_PROG_PKG_CONFIG: command not found/tmp/ccKQYNxd.s: Assembler messages:/tmp/ccKQYNxd.s: Fatal error: can't close Parser/parser.o: No space left on devicemake: *** [Parser/parser.o] Error 1find: ‘build’: No such file or directoryfind: ‘build’: No such file or directoryfind: ‘build’: No such file or directoryfind: ‘build’: No such file or directorymake: [clean-retain-profile] Error 1 (ignored)

@iritkatriel

Copy link
Copy Markdown
MemberAuthor

The build failure seems unrelated to this change:

/tmp/ccKQYNxd.s: Assembler messages:
/tmp/ccKQYNxd.s: Fatal error: can't close Parser/parser.o: No space left on device
make: *** [Parser/parser.o] Error 1

shihai1991 added a commit to shihai1991/cpython that referenced this pull request Jul 20, 2021
* origin/main: (1146 commits)
bpo-42064: Finalise establishing sqlite3 global state (pythonGH-27155)
bpo-44678: Separate error message for discontinuous padding in binascii.a2b_base64 strict mode (pythonGH-27249)
correct spelling (pythonGH-27076)
bpo-44524: Add missed __name__ and __qualname__ to typing module objects (python#27237)
bpo-27513: email.utils.getaddresses() now handles Header objects (python#13797)
Clean up comma usage in Doc/library/functions.rst (python#27083)
bpo-42238: Fix small rst issue in NEWS.d/. (python#27238)
bpo-41972: Tweak fastsearch.h string search algorithms (pythonGH-27091)
bpo-44340: Add support for building with clang full/thin lto (pythonGH-27231)
bpo-44661: Update property_descr_set to use vectorcall if possible. (pythonGH-27206)
bpo-44645: Check for interrupts on any potentially backwards edge (pythonGH-27216)
bpo-41546: make pprint (like print) not write to stdout when it is None (pythonGH-26810)
bpo-44554: refactor pdb targets (and internal tweaks) (pythonGH-26992)
bpo-43086: Add handling for out-of-spec data in a2b_base64 (pythonGH-24402)
bpo-44561: Update hyperlinks in Doc/distributing/index.rst (python#27032)
bpo-42355: symtable.get_namespace() now checks whether there are multiple or any namespaces found (pythonGH-23278)
bpo-44654: Do not export the union type related symbols (pythonGH-27223)
bpo-44633: Fix parameter substitution of the union type with wrong types. (pythonGH-27218)
bpo-44654: Refactor and clean up the union type implementation (pythonGH-27196)
bpo-20291: Fix MSVC warnings in getargs.c (pythonGH-27211)
...
@iritkatriel
iritkatriel deleted the bpo-41546 branch August 2, 2021 14:14
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-featureA feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@iritkatriel@serhiy-storchaka@bedevere-bot@merwok@eryksun@the-knights-who-say-ni