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
base: main
Are you sure you want to change the base?
Conversation
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 MissingOur records indicate the following people have not signed the CLA: 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 You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
…ython into bugfix/pprint-set-ordering
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 \ |
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.
Sorry, but this block is almost a complete duplicate of the one above (please fix that).
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.
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.
Misc/NEWS.d/next/Library/2020-10-26-14-20-58.bpo-27495.OWavSt.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
…ython into bugfix/pprint-set-ordering
This PR is stale because it has been open for 30 days with no activity. |
I would like to see this get merged in. Is there anything I can do to help get this merged? |
This makes the
pprint.pformat
perform the default ordering on allset
andfrozenset
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