[issue39524] Escape sequences in doc string of ast._pad_whitespace
New submission from mpheath : In the ast module, a function named _pad_whitespace has a doc string with escape sequences of \f and \t. The current doc string from Lib/ast.py:305 is: """Replace all chars except '\f\t' in a line with spaces.""" Example of doc string output in a REPL: Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import ast >>> import inspect >>> inspect.getdoc(ast._pad_whitespace) "Replace all chars except '\x0c ' in a line with spaces." >>> The \x0c is the formfeed and the ' ' (5 spaces) was the tab. It is my understanding that the output should be: "Replace all chars except '\f\t' in a line with spaces." I would expect the source to be: """Replace all chars except '\\f\\t' in a line with spaces.""" or perhaps a raw string: r"""Replace all chars except '\f\t' in a line with spaces.""" The current Lib/ast.py:305 is Python 3.9.0 alpha 3 though the issue is also in Python 3.8.0 and 3.8.1 with 3.8/Lib/ast.py:227 . Python 3.7.4 3.7/Lib/ast.py does not have the function _pad_whitespace as it appears major code changes occurred in the ast module with Python 3.8.0. -- messages: 361203 nosy: mpheath priority: normal severity: normal status: open title: Escape sequences in doc string of ast._pad_whitespace type: behavior versions: Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue39524> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39524] Escape sequences in doc string of ast._pad_whitespace
mpheath added the comment: Correction: Python 3.8.0 and 3.8.1 with Lib/ast.py:277 Line 227 is invalid and 277 is correct. -- ___ Python tracker <https://bugs.python.org/issue39524> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39524] Escape sequences in doc string of ast._pad_whitespace
mpheath added the comment: Correction: Python 3.8.0 and 3.8.1 with 3.8/Lib/ast.py:277 Line 227 is invalid and 277 is correct and forgot to add 3.8 prefix. Sorry. -- ___ Python tracker <https://bugs.python.org/issue39524> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39524] Escape sequences in doc string of ast._pad_whitespace
Change by mpheath : -- keywords: +patch pull_requests: +17712 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/18340 ___ Python tracker <https://bugs.python.org/issue39524> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39524] Escape sequences in doc string of ast._pad_whitespace
Change by mpheath : -- pull_requests: +17713 pull_request: https://github.com/python/cpython/pull/18341 ___ Python tracker <https://bugs.python.org/issue39524> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39524] Escape sequences in doc string of ast._pad_whitespace
mpheath added the comment: I have submitted 2 Pull Requests. One for 3.9 and the other for 3.8. Only way I knew was to create 2 separate branches to checkout, linked to version tags to get the correct patches for ast.py. Hope is OK. -- ___ Python tracker <https://bugs.python.org/issue39524> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39524] Escape sequences in doc string of ast._pad_whitespace
Change by mpheath : -- pull_requests: +17714 pull_request: https://github.com/python/cpython/pull/18342 ___ Python tracker <https://bugs.python.org/issue39524> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com