https://github.com/python/cpython/commit/4cba0e66c29b46afbb1eee1d0428f5a2f5b891bb
commit: 4cba0e66c29b46afbb1eee1d0428f5a2f5b891bb
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: terryjreedy <[email protected]>
date: 2024-11-30T08:13:13Z
summary:

[3.13] gh-127303: Add docs for token.EXACT_TOKEN_TYPES (GH-127304) (#127390)

gh-127303: Add docs for token.EXACT_TOKEN_TYPES (GH-127304)

---------

(cherry picked from commit dd3a87d2a8f8750978359a99de2c5cb2168351d1)

Co-authored-by: Илья Любавский <[email protected]>
Co-authored-by: Terry Jan Reedy <[email protected]>
Co-authored-by: Tomas R. <[email protected]>
Co-authored-by: Bénédikt Tran <[email protected]>

files:
A Misc/NEWS.d/next/Library/2024-11-27-16-06-10.gh-issue-127303.asqkgh.rst
M Doc/library/token.rst
M Lib/token.py
M Misc/ACKS
M Tools/build/generate_token.py

diff --git a/Doc/library/token.rst b/Doc/library/token.rst
index 0cc9dddd91ed6b..40982f32b4beee 100644
--- a/Doc/library/token.rst
+++ b/Doc/library/token.rst
@@ -79,6 +79,13 @@ the :mod:`tokenize` module.
    ``type_comments=True``.
 
 
+.. data:: EXACT_TOKEN_TYPES
+
+   A dictionary mapping the string representation of a token to its numeric 
code.
+
+   .. versionadded:: 3.8
+
+
 .. versionchanged:: 3.5
    Added :data:`!AWAIT` and :data:`!ASYNC` tokens.
 
diff --git a/Lib/token.py b/Lib/token.py
index b620317106e173..54d7cdccadc79a 100644
--- a/Lib/token.py
+++ b/Lib/token.py
@@ -1,7 +1,8 @@
 """Token constants."""
 # Auto-generated by Tools/build/generate_token.py
 
-__all__ = ['tok_name', 'ISTERMINAL', 'ISNONTERMINAL', 'ISEOF']
+__all__ = ['tok_name', 'ISTERMINAL', 'ISNONTERMINAL', 'ISEOF',
+           'EXACT_TOKEN_TYPES']
 
 ENDMARKER = 0
 NAME = 1
diff --git a/Misc/ACKS b/Misc/ACKS
index d3bf8450fcbb4f..bed3e028d0a18d 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1149,6 +1149,7 @@ Mark Lutz
 Taras Lyapun
 Jim Lynch
 Mikael Lyngvig
+Ilya Lyubavski
 Jeff MacDonald
 John Machin
 Andrew I MacIntyre
diff --git 
a/Misc/NEWS.d/next/Library/2024-11-27-16-06-10.gh-issue-127303.asqkgh.rst 
b/Misc/NEWS.d/next/Library/2024-11-27-16-06-10.gh-issue-127303.asqkgh.rst
new file mode 100644
index 00000000000000..58ebf5d0abe141
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-11-27-16-06-10.gh-issue-127303.asqkgh.rst
@@ -0,0 +1 @@
+Publicly expose :data:`~token.EXACT_TOKEN_TYPES` in :attr:`!token.__all__`.
diff --git a/Tools/build/generate_token.py b/Tools/build/generate_token.py
index 16c38841e44a4d..d32747f19945d8 100755
--- a/Tools/build/generate_token.py
+++ b/Tools/build/generate_token.py
@@ -226,7 +226,8 @@ def make_rst(infile, outfile='Doc/library/token-list.inc'):
 # {AUTO_GENERATED_BY_SCRIPT}
 '''
 token_py_template += '''
-__all__ = ['tok_name', 'ISTERMINAL', 'ISNONTERMINAL', 'ISEOF']
+__all__ = ['tok_name', 'ISTERMINAL', 'ISNONTERMINAL', 'ISEOF',
+           'EXACT_TOKEN_TYPES']
 
 %s
 N_TOKENS = %d

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to