diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-10-15 08:33:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-15 08:33:19 -0700 |
commit | 84a26e114ed5ca080ffe2f84aa0b7c59848afed6 (patch) | |
tree | 53a1b78c7bccee7d8c8856d1ae5c22b02a3c9c83 /Tools | |
parent | gh-98251: Allow venv to pass along PYTHON* variables to pip and ensurepip whe... (diff) | |
download | cpython-84a26e114ed5ca080ffe2f84aa0b7c59848afed6.tar.gz cpython-84a26e114ed5ca080ffe2f84aa0b7c59848afed6.tar.bz2 cpython-84a26e114ed5ca080ffe2f84aa0b7c59848afed6.zip |
gh-95731: Fix module docstring extraction in pygettext (GH-95732)
(cherry picked from commit 120b4ab2b68aebf96ce0de243eab89a25fc2d282)
Co-authored-by: Jakub Kuczys <me@jacken.men>
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/i18n/pygettext.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Tools/i18n/pygettext.py b/Tools/i18n/pygettext.py index 6f889adffe6..7ada79105db 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 |