diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-10-16 04:15:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-16 04:15:17 (GMT) |
commit | b5874fae0a618e4b0815a54242b0703bd92482be (patch) | |
tree | e1c084b2c3f68727215e85a34acd204d225f15fb /Tools | |
parent | a2ae35dfa4605f3f6a1777ce136b3872dcb97a8e (diff) | |
download | cpython-b5874fae0a618e4b0815a54242b0703bd92482be.zip cpython-b5874fae0a618e4b0815a54242b0703bd92482be.tar.gz cpython-b5874fae0a618e4b0815a54242b0703bd92482be.tar.bz2 |
[3.11] gh-95731: Fix module docstring extraction in pygettext (GH-95732) (#98281)
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 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 |