summaryrefslogtreecommitdiffstats
path: root/Tools/i18n/pygettext.py
diff options
context:
space:
mode:
authorJakub Kuczys <me@jacken.men>2022-10-15 14:57:53 (GMT)
committerGitHub <noreply@github.com>2022-10-15 14:57:53 (GMT)
commit120b4ab2b68aebf96ce0de243eab89a25fc2d282 (patch)
tree1fc1b9e2dabb77c995fddebd19f0b0f2c1beea8e /Tools/i18n/pygettext.py
parent07b5c4699e64eb30c3bdcb1275c167e675d37423 (diff)
downloadcpython-120b4ab2b68aebf96ce0de243eab89a25fc2d282.zip
cpython-120b4ab2b68aebf96ce0de243eab89a25fc2d282.tar.gz
cpython-120b4ab2b68aebf96ce0de243eab89a25fc2d282.tar.bz2
gh-95731: Fix module docstring extraction in pygettext (#95732)
Diffstat (limited to 'Tools/i18n/pygettext.py')
-rwxr-xr-xTools/i18n/pygettext.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Tools/i18n/pygettext.py b/Tools/i18n/pygettext.py
index 6f889adf..7ada791 100755
--- a/Tools/i18n/pygettext.py
+++ b/Tools/i18n/pygettext.py
@@ -335,9 +335,10 @@ class TokenEater:
if ttype == tokenize.STRING and is_literal_string(tstring):
self.__addentry(safe_eval(tstring), lineno, isdocstring=1)
self.__freshmodule = 0
- elif ttype not in (tokenize.COMMENT, tokenize.NL):
- self.__freshmodule = 0
- return
+ return
+ if ttype in (tokenize.COMMENT, tokenize.NL, tokenize.ENCODING):
+ return
+ self.__freshmodule = 0
# class or func/method docstring?
if ttype == tokenize.NAME and tstring in ('class', 'def'):
self.__state = self.__suiteseen