gh-85989: deprecate float.__getformat__() class method - #146400
gh-85989: deprecate float.__getformat__() class method#146400skirpichev wants to merge 21 commits into
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__().
It can be false for other Python implementations, using the CPython test suite.
It can, but what this will mean? |
|
|
I'm not sure that it means. The former test just check a random finite number. Does this ensure that we have support for infinities and nans? Have subnormals? I proposed to expose
I don't think there are cases, where sys.byteorder not cover this.
And it's meaning?.. I think we may want flag like
Victor did. I think this fits above conclusion (using for tests).
Ok, I'm going to close this pr, unless there are other opinions. |
|
Don't close, just open a discussion on https://discuss.python.org/, wait a week, and then we will see if there are any serious ideas or arguments for or against the deprecation. |
See https://discuss.python.org/t/deprecate-float-getformat/107151. Sadly, this couldn't enter v3.15. |
Documentation build overview
301 files changed ·
|
I think there aren't, no? The sys.float_info also restricts it's scope to the |
|
@sobolevn, any idea why now test_detach_materialized_dict_no_memory() fails on this pr? Looks entirely unrelated to it's content. |
This reverts commit 40f9873.
ee74068 to
1389d58
Compare
📚 Documentation preview 📚: https://cpython-previews--146400.org.readthedocs.build/