Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-27495: Make pprint.pformat always order sets #22977

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

bbonenfant
Copy link

@bbonenfant bbonenfant commented Oct 25, 2020

This makes the pprint.pformat perform the default ordering on all set and frozenset objects. This was determined to be a bug, since these objects are ordered if they violate the maximum width of the output, but was never fixed.

Reference: https://bugs.python.org/issue27495

https://bugs.python.org/issue27495

@the-knights-who-say-ni
Copy link

the-knights-who-say-ni commented Oct 25, 2020

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@bbonenfant

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

Lib/pprint.py Outdated
@@ -589,6 +589,37 @@ def _safe_repr(self, object, context, maxlevels, level):
del context[objid]
return format % ", ".join(components), readable, recursive

if (issubclass(typ, set) and r is set.__repr__) or \
Copy link
Contributor

@ZackerySpytz ZackerySpytz Dec 5, 2020

Choose a reason for hiding this comment

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

Sorry, but this block is almost a complete duplicate of the one above (please fix that).

Copy link
Author

@bbonenfant bbonenfant Dec 5, 2020

Choose a reason for hiding this comment

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

I have merged this section with the above one. Please let me know if this is satisfactory. I originally separated them to follow the layout of the function and separate out new code from old code.

Lib/test/test_pprint.py Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Jan 5, 2021

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Stale PR or inactive for long period of time. label Jan 5, 2021
@tyates-indeed
Copy link

tyates-indeed commented Jul 29, 2021

I would like to see this get merged in. Is there anything I can do to help get this merged?

Copy link
Contributor

@MaxwellDupre MaxwellDupre left a comment

I see test results say:
Ran 35 tests in 0.123s
OK (expected failures=1)
Looks ok to me.

@github-actions github-actions bot removed the stale Stale PR or inactive for long period of time. label Jul 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants