Uh oh!
There was an error while loading. Please reload this page.
gh-85989: deprecate float.__getformat__() class method - #146400
gh-85989: deprecate float.__getformat__() class method#146400skirpichev wants to merge 22 commits into
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
skirpichev
commented
Apr 1, 2026
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
skirpichev
commented
Apr 1, 2026
@vstinner, please don't merge. I would appreciate a second review. |
serhiy-storchaka
commented
Apr 1, 2026
in general, I like removing private, unsystematic, undocumented methods which only serve internal debugging purpose. There some things in |
skirpichev
commented
Apr 1, 2026
The
This private API now is helpful only for alternative implementations, which run the CPython test suite. I don't see how a special testing module would help here. See #145633 (comment) for some usage examples. |
mwhudson
commented
Apr 17, 2026
Oh dear me that was nearly 21 years ago! Unsurprisingly the details have faded a bit but I'm pretty sure this was around making |
skirpichev
commented
Apr 17, 2026
The problem is that the CPython test suite used in alternative implementations, like PyPy. In principle they may not require IEEE-compatible formats for floats. That's why @mdickinsonsuggested to keep |
Uh oh!
There was an error while loading. Please reload this page.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Would not be better to first add a field to sys.version_info? Then, few versions late, we can deprecate float.__getformat__().
Uh oh!
There was an error while loading. Please reload this page.
Documentation build overview
301 files changed · |
skirpichev
commented
May 26, 2026
I think there aren't, no? The sys.float_info also restricts it's scope to the |
This comment was marked as outdated.
This comment was marked as outdated.
ee74068 to
1389d58Compare
This comment has been minimized.
This comment has been minimized.
| self.assertEqual(dict.fromkeys.__qualname__, 'dict.fromkeys') | ||
| self.assertEqual(float.__getformat__.__qualname__, | ||
| 'float.__getformat__') | ||
| self.assertEqual(int.from_bytes.__qualname__, 'int.from_bytes') |
There was a problem hiding this comment.
Should the replacement also be a dunder method?
There was a problem hiding this comment.
There is nothing special for such case, except for a name.
Commentary says those should be class methods. I would guess not so many were available in v3.2, when the test was added (5b62942).
vstinner
commented
Aug 7, 2026
I don't think that you can simply deprecate (and later remove) We need a replacement like See the SC decision: capi-workgroup/decisions#107 (comment). Can you write a first PR to add |
skirpichev
commented
Aug 8, 2026
What this flag (?) will mean? Current testing helper has no clear meaning, it's a poor-mans replacement for |
📚 Documentation preview 📚: https://cpython-previews--146400.org.readthedocs.build/