bpo-45995: add "z" format specifer to coerce negative 0 to zero#30049
bpo-45995: add "z" format specifer to coerce negative 0 to zero#30049mdickinson merged 25 commits into
Conversation
97a033b to
8ff811f
Compare
December 11, 2021 13:44
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
|
Removing the stale label; discussion is ongoing on the bug tracker. |
Sorry, something went wrong.
1bfb289 to
bb4d5f1
Compare
February 4, 2022 02:46
|
Update: the PEP has been accepted - https://discuss.python.org/t/accepting-pep-682-format-specifier-for-signed-zero/14088 We should aim to get this reviewed and in by the next (and final) alpha release of 3.11, due April 5th. |
Sorry, something went wrong.
mdickinson
left a comment
There was a problem hiding this comment.
Hi @belm0. Here's a first-pass review; apologies for taking so long to get to this.
Most of the comments are nitpick-level. The big exception is the Decimal code, where I think there's still significant work to do.
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
|
@ericvsmith: if you have any bandwidth to look over the code at some point before the first 3.11 beta, I'd appreciate your input. |
Sorry, something went wrong.
belm0
left a comment
There was a problem hiding this comment.
Thank you for the thorough review!
I'm bogged down a bit and it may take a week or so to reconcile the comments.
Hoping to get this merged for the next (final) alpha.
3.11.0 alpha 7: Tuesday, 2022-04-05
3.11.0 beta 1: Friday, 2022-05-06
Sorry, something went wrong.
This covers str.format() and f-strings. Old-style string interpolation is not supported. TODO: Decimal support
mdickinson
left a comment
There was a problem hiding this comment.
Here's a second-pass review. We're getting there, but there are still a couple of bugs to resolve.
Sorry, something went wrong.
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
mdickinson
left a comment
There was a problem hiding this comment.
Thank you for the updates! This looks ready to merge to me. I've been running some automated tests that cover a wide variety of combinations, and haven't yet managed to break this. :-)
A bit off-topic: I do think we're introducing some DRY-type technical debt into _decimal.c, though for this PR I don't see an easy alternative. For the future, there's scope for some cleanup after lifting the formatting machinery from libmpdec to _decimal.c. That's for another day, though.
Sorry, something went wrong.
ericvsmith
left a comment
There was a problem hiding this comment.
Other than possibly adding a credit in the blurb, this looks good to me.
Sorry, something went wrong.
Sorry, something went wrong.
|
using file edit from the github UI appears to have angered CLA bot and bedevere |
Sorry, something went wrong.
I think it's related to the bpo to github issues migration. I'll see what I can figure out. |
Sorry, something went wrong.
|
The "CLA Signing" check doesn't seem to be required for merging. Given that we know that CLA signing has occurred, I think we should be okay to merge. I've reported the failure to @ambv. |
Sorry, something went wrong.
The implementation of PEP 682 was completed in python/cpython#30049.
The implementation of PEP 682 was completed in python/cpython#30049.
This option coerces negative zero into zero after rounding to the format precision.
Covers formatting of standard fraction types (
float,Decimal,complex) viastr.format(), built-informat(), and f-strings. Old-style string interpolationis not supported.
https://www.python.org/dev/peps/pep-0682/
https://bugs.python.org/issue45995