Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Link tokens in the format string grammars #108184

Merged
merged 8 commits into from Jan 9, 2024

Conversation

wjandrea
Copy link
Contributor

@wjandrea wjandrea commented Aug 20, 2023

Fix links from Format String Syntax grammar and Format Specification Mini-Language grammar to Python grammar.
Also link arg_name token within Format String Syntax grammar.


Please check my work. I'm not very familiar with RST, just read the docs on productionlists and did my best.

Should be backported to all current versions.


📚 Documentation preview 📚: https://cpython-previews--108184.org.readthedocs.build/en/108184/library/string.html#format-string-syntax

Fix links from Format String Syntax grammar and Format Specification Mini-Language grammar to Python grammar.
Also link `arg_name` token within Format String Syntax grammar.
@bedevere-bot bedevere-bot added docs Documentation in the Doc dir skip news awaiting review labels Aug 20, 2023
@AA-Turner AA-Turner added needs backport to 3.11 bug and security fixes needs backport to 3.12 bug and security fixes labels Aug 21, 2023
@wjandrea
Copy link
Contributor Author

Looks like the links to python-grammar didn't work. I'm not sure if that's cause the test failed or what.

@AA-Turner
Copy link
Member

See #109209 and #109210.

@AA-Turner AA-Turner changed the title Docs: Fix grammar token links in string.rst Docs: Link grammar token links in string.rst Sep 10, 2023
@AA-Turner AA-Turner changed the title Docs: Link grammar token links in string.rst Docs: Link tokens in the format string grammars Sep 10, 2023
@skirpichev
Copy link
Contributor

@wjandrea, could you, please, resolve merge conflicts?

BTW, shouldn't we also bug sphinx-doc (I don't see related issue(s))?

@skirpichev
Copy link
Contributor

FYI: sphinx-doc/sphinx#11854

skirpichev added a commit to skirpichev/cpython that referenced this pull request Jan 7, 2024
This add hexadecimal floating point literals (IEEE 754-2008 §5.12.3) and
support construction of floats from hexadecimal strings.  Note that the
float constructor accepts more permissive syntax (everything that is
currently accepted by the float.fromhex, but with a mandatory base
specifier; it also allows grouping digits with underscores).

Examples:
```pycon
>>> 0x1.1p-1
0.53125
>>> float('0x1.1')
1.0625
>>> 0x1.1
  File "<stdin>", line 1
    0x1.1
        ^
SyntaxError: invalid floating point literal
```

Minor changes:
* Py_ISDIGIT/ISXDIGIT macros were transformed to functions
* cherry-picked sphinx workaround from python#108184
skirpichev added a commit to skirpichev/cpython that referenced this pull request Jan 8, 2024
This add hexadecimal floating point literals (IEEE 754-2008 §5.12.3) and
support construction of floats from hexadecimal strings.  Note that the
float constructor accepts more permissive syntax (everything that is
currently accepted by the float.fromhex, but with a mandatory base
specifier; it also allows grouping digits with underscores).

Examples:
```pycon
>>> 0x1.1p-1
0.53125
>>> float('0x1.1')
1.0625
>>> 0x1.1
  File "<stdin>", line 1
    0x1.1
        ^
SyntaxError: invalid floating point literal
```

Minor changes:
* Py_ISDIGIT/ISXDIGIT macros were transformed to functions
* cherry-picked sphinx workaround from python#108184
@wjandrea
Copy link
Contributor Author

wjandrea commented Jan 9, 2024

@skirpichev merge conflicts resolved

Doc/library/string.rst Outdated Show resolved Hide resolved
@skirpichev
Copy link
Contributor

LGTM, except for two nitpicks

@AA-Turner?

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
@AA-Turner AA-Turner enabled auto-merge (squash) January 9, 2024 02:41
@AA-Turner AA-Turner merged commit f3d5d4a into python:main Jan 9, 2024
23 checks passed
@miss-islington-app
Copy link

Thanks @wjandrea for the PR, and @AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤄1�7

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 9, 2024
(cherry picked from commit f3d5d4a)

Co-authored-by: William Andrea <william.j.andrea@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 9, 2024
(cherry picked from commit f3d5d4a)

Co-authored-by: William Andrea <william.j.andrea@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Jan 9, 2024

GH-113839 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Jan 9, 2024
@bedevere-app
Copy link

bedevere-app bot commented Jan 9, 2024

GH-113840 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 bug and security fixes label Jan 9, 2024
AA-Turner added a commit that referenced this pull request Jan 9, 2024
 1�7113840)

Docs: Link tokens in the format string grammars (GH-108184)
(cherry picked from commit f3d5d4a)

Co-authored-by: William Andrea <william.j.andrea@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
AA-Turner added a commit that referenced this pull request Jan 9, 2024
 1�7113839)

Docs: Link tokens in the format string grammars (GH-108184)
(cherry picked from commit f3d5d4a)

Co-authored-by: William Andrea <william.j.andrea@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
@wjandrea wjandrea deleted the wjandrea-patch_grammar-token-links branch January 9, 2024 04:01
skirpichev added a commit to skirpichev/cpython that referenced this pull request Jan 9, 2024
This add hexadecimal floating point literals (IEEE 754-2008 §5.12.3) and
support construction of floats from hexadecimal strings.  Note that the
float constructor accepts more permissive syntax (everything that is
currently accepted by the float.fromhex, but with a mandatory base
specifier; it also allows grouping digits with underscores).

Examples:
```pycon
>>> 0x1.1p-1
0.53125
>>> float('0x1.1')
1.0625
>>> 0x1.1
  File "<stdin>", line 1
    0x1.1
        ^
SyntaxError: invalid floating point literal
```

Minor changes:
* Py_ISDIGIT/ISXDIGIT macros were transformed to functions
* cherry-picked sphinx workaround from python#108184
skirpichev added a commit to skirpichev/cpython that referenced this pull request Jan 9, 2024
This add hexadecimal floating point literals (IEEE 754-2008 §5.12.3) and
support construction of floats from hexadecimal strings.  Note that the
float constructor accepts more permissive syntax (everything that is
currently accepted by the float.fromhex, but with a mandatory base
specifier; it also allows grouping digits with underscores).

Examples:
```pycon
>>> 0x1.1p-1
0.53125
>>> float('0x1.1')
1.0625
>>> 0x1.1
  File "<stdin>", line 1
    0x1.1
        ^
SyntaxError: invalid floating point literal
```

Minor changes:
* Py_ISDIGIT/ISXDIGIT macros were transformed to functions
* cherry-picked sphinx workaround from python#108184
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants