| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
@vstinner, please don't merge. I would appreciate a second review. |
Sorry, something went wrong.
|
in general, I like removing private, unsystematic, undocumented methods which only serve internal debugging purpose. There some things in bytearray and set. But first we need to look at their history and ask authors who added them. Do they still need them? I think that special testing module would be better place for such things. |
Sorry, something went wrong.
The __getformat__() class method, together with removed __setformat__() was added by ba283e2. CC @mwhudson
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. |
Sorry, something went wrong.
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 struct.{pack,unpack} work with NaNs and infs and such. If Python requires IEEE 754 to build then I think it can all be regarded as historical fluff and deprecated then deleted. |
Sorry, something went wrong.
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 requires_IEEE_754 decorator. Which, in turn, needs something to check that this requirement is satisfied. New helper does same checks as before, if ctypes module is available. |
Sorry, something went wrong.
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__().
Sorry, something went wrong.
Documentation build overview455 files changed · + 18 added · ± 435 modified · - 2 deleted + Added
± Modified
- Deleted |
Sorry, something went wrong.
I think there aren't, no? The sys.float_info also restricts it's scope to the float.h header. Lets not break it without good reasons. The C standard now have DBL_IS_IEC_60559 flag here, but it doesn't indicate something like conformance to the IEEE 754 double format. We can expose this, but I doubt it's a replacement for the current test. |
Sorry, something went wrong.
This reverts commit 40f9873.
|
I don't think that you can simply deprecate (and later remove) float.__getformat__() with no replacement. We need a replacement like sys.float_info.ieee_754 which would be used by @support.requires_IEEE_754. See the SC decision: capi-workgroup/decisions#107 (comment). Can you write a first PR to add sys.float_info.ieee_754? |
Sorry, something went wrong.
__getformat__() was private, testing-only API. We have replacement for this: it's current PR with a helper for tests.
What this flag (?) will mean? Current testing helper has no clear meaning, it's a poor-mans replacement for __STDC_IEC_559__ define. |
Sorry, something went wrong.
|
@vstinner, should I restore #138811 with a correction that if __STDC_IEC_559__ is not defined - we fallback on the __getformat__() code, instead? (Maybe flag should be renamed to ieee_754.) I worry, that we could have false positives on this road. As Mark said in the issue thread, we have no reliable way to tell whether floats use IEEE 754 (I don't see any other appropriate meaning for the new flag). |
Sorry, something went wrong.
# Conflicts: # Doc/whatsnew/3.16.rst
| Back | FazBrowse Home | New Git URL |
📚 Documentation preview 📚: https://cpython-previews--146400.org.readthedocs.build/