gh-145633: deprecate float.__getformat__() class method#146400
gh-145633: deprecate float.__getformat__() class method#146400skirpichev wants to merge 14 commits intopython:mainfrom
Conversation
|
@vstinner, please don't merge. I would appreciate a second review. |
|
in general, I like removing private, unsystematic, undocumented methods which only serve internal debugging purpose. There some things in |
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. |
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 |
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 @mdickinson suggested to keep |
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__().
@serhiy-storchaka, not sure I get this part of you proposal. Could you elaborate? |
|
|
||
| def collect_builtins(info_add): | ||
| info_add('builtins.float.float_format', float.__getformat__("float")) | ||
| info_add('builtins.float.double_format', float.__getformat__("double")) |
There was a problem hiding this comment.
Can you modify collect_support() to log support.HAVE_IEEE_754?
There was a problem hiding this comment.
Why do you think this make sense? For CPython builds this flag is True unconditionally.
There was a problem hiding this comment.
To help debugging issues if HAVE_IEEE_754 is false for whatever reasons.
There was a problem hiding this comment.
I would consider case when sys.implementation.name != 'cpython' for CPython as very unlikely scenario.
Do you mean sys.float_info? Which members do you want to add? |
📚 Documentation preview 📚: https://cpython-previews--146400.org.readthedocs.build/