GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-41546: make pprint (like print) not write to stdout when it is None by iritkatriel · Pull Request #26810 · python/cpython

Conversation

@iritkatriel

@iritkatriel iritkatriel commented Jun 20, 2021 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

https://bugs.python.org/issue41546

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Jun 20, 2021
@bedevere-bot bedevere-bot added the awaiting core review label Jun 20, 2021
@iritkatriel iritkatriel changed the title bpo-41546: pprint (like print) does not write to stdout when it is None bpo-41546: make pprint (like print) not write to stdout when it is None Jun 20, 2021
@iritkatriel
iritkatriel requested a review from zooba June 20, 2021 14:03
eryksun
eryksun reviewed Jun 20, 2021
View reviewed changes
Comment thread Lib/pprint.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@iritkatriel
iritkatriel requested a review from serhiy-storchaka June 23, 2021 16:07
@iritkatriel

iritkatriel commented Jul 2, 2021

Copy link
Copy Markdown
Member Author

Any more comments before I merge?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka
serhiy-storchaka reviewed Jul 3, 2021
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Please document the change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_pprint.py Outdated
Comment on lines 252 to 254

@serhiy-storchaka serhiy-storchaka Jul 3, 2021

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iritkatriel iritkatriel Jul 3, 2021

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@serhiy-storchaka

serhiy-storchaka commented Jul 3, 2021

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iritkatriel

iritkatriel commented Jul 3, 2021

Copy link
Copy Markdown
Member Author

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

serhiy-storchaka commented Jul 3, 2021

Copy link
Copy Markdown
Member

Why not in this PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iritkatriel

iritkatriel commented Jul 3, 2021

Copy link
Copy Markdown
Member Author

Why not in this PR?

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iritkatriel and others added 6 commits July 3, 2021 21:43
@iritkatriel
bpo-41546: pprint (like print) does not write to stdout when it is None
69741ec
@blurb-it @iritkatriel
📜🤖 Added by blurb_it.
793fba5
@iritkatriel
skip formatting altogether if stdout is None
214fb4f
@iritkatriel
edit news
be4404e
@iritkatriel
Remove redundant test
db4e471
@iritkatriel
mention the change in the docs. Remove repetition of version directiv…
62af033
…es for shared parameters.
@iritkatriel
iritkatriel force-pushed the bpo-41546 branch from 62d8559 to 62af033 Compare July 3, 2021 20:54
@iritkatriel

iritkatriel commented Jul 18, 2021

Copy link
Copy Markdown
Member Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka
serhiy-storchaka approved these changes Jul 18, 2021
View reviewed changes
Comment thread Doc/library/pprint.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Jul 18, 2021
@iritkatriel @serhiy-storchaka
Update Doc/library/pprint.rst to add backticks around None
fba7e43
Co-authored-by: Serhiy Storchaka <[email protected]>
merwok
merwok reviewed Jul 19, 2021
View reviewed changes
Comment thread Doc/library/pprint.rst
Added the *sort_dicts* parameter.

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

@merwok merwok Jul 19, 2021

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iritkatriel iritkatriel Jul 19, 2021

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@merwok merwok Jul 19, 2021

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iritkatriel iritkatriel Jul 19, 2021

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@iritkatriel
iritkatriel merged commit aab1899 into python:main Jul 19, 2021
@bedevere-bot bedevere-bot removed the awaiting merge label Jul 19, 2021
@bedevere-bot

bedevere-bot commented Jul 19, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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.�[K
remote: Counting objects:   3% (1/26)�[K
remote: Counting objects:   7% (2/26)�[K
remote: Counting objects:  11% (3/26)�[K
remote: Counting objects:  15% (4/26)�[K
remote: Counting objects:  19% (5/26)�[K
remote: Counting objects:  23% (6/26)�[K
remote: Counting objects:  26% (7/26)�[K
remote: Counting objects:  30% (8/26)�[K
remote: Counting objects:  34% (9/26)�[K
remote: Counting objects:  38% (10/26)�[K
remote: Counting objects:  42% (11/26)�[K
remote: Counting objects:  46% (12/26)�[K
remote: Counting objects:  50% (13/26)�[K
remote: Counting objects:  53% (14/26)�[K
remote: Counting objects:  57% (15/26)�[K
remote: Counting objects:  61% (16/26)�[K
remote: Counting objects:  65% (17/26)�[K
remote: Counting objects:  69% (18/26)�[K
remote: Counting objects:  73% (19/26)�[K
remote: Counting objects:  76% (20/26)�[K
remote: Counting objects:  80% (21/26)�[K
remote: Counting objects:  84% (22/26)�[K
remote: Counting objects:  88% (23/26)�[K
remote: Counting objects:  92% (24/26)�[K
remote: Counting objects:  96% (25/26)�[K
remote: Counting objects: 100% (26/26)�[K
remote: Counting objects: 100% (26/26), done.�[K
remote: Compressing objects:   7% (1/14)�[K
remote: Compressing objects:  14% (2/14)�[K
remote: Compressing objects:  21% (3/14)�[K
remote: Compressing objects:  28% (4/14)�[K
remote: Compressing objects:  35% (5/14)�[K
remote: Compressing objects:  42% (6/14)�[K
remote: Compressing objects:  50% (7/14)�[K
remote: Compressing objects:  57% (8/14)�[K
remote: Compressing objects:  64% (9/14)�[K
remote: Compressing objects:  71% (10/14)�[K
remote: Compressing objects:  78% (11/14)�[K
remote: Compressing objects:  85% (12/14)�[K
remote: Compressing objects:  92% (13/14)�[K
remote: Compressing objects: 100% (14/14)�[K
remote: Compressing objects: 100% (14/14), done.�[K
remote: 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 device
make: *** [Parser/parser.o] Error 1

find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make: [clean-retain-profile] Error 1 (ignored)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iritkatriel

iritkatriel commented Jul 19, 2021

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

shihai1991 added a commit to shihai1991/cpython that referenced this pull request Jul 20, 2021
@shihai1991
Merge remote-tracking branch 'origin/main' into bpo_42035
56e8889
* 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 free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@merwok merwok merwok left review comments
@eryksun eryksun eryksun left review comments
@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes
@zooba zooba Awaiting requested review from zooba

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

type-feature A feature request or enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@iritkatriel @serhiy-storchaka @bedevere-bot @merwok @eryksun @the-knights-who-say-ni
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.