gh-77748: Document that float() accepts bytes-like objects - #155501
gh-77748: Document that float() accepts bytes-like objects#155501Qanty228 wants to merge 18 commits into
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
skirpichev
left a comment
There was a problem hiding this comment.
You should also modify the sphinx docs (https://docs.python.org/3.14/library/functions.html#float).
Documentation build overview
47 files changed ·
|
| If the argument is a bytes-like object, its contents are parsed as a decimal | ||
| string. Therefore, the bytes-like object must contain a valid representation | ||
| of a floating-point number, otherwise :exc:`ValueError` is raised. |
There was a problem hiding this comment.
It's a wrong place. Move it under the productionlist directive, after full description of the string output.
And rephrase somehow like this: "Bytes-like argument should contain only sequence of ASCII characters, conforming to the :token:~float:floatvalue rule."
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
fixes #77748
Update the
float.__new__docstring to state thatfloat()accepts bytes-like objects.