New submission from Anthony Sottile <asott...@umich.edu>:
this was noticed in pyflakes's testsuite: https://github.com/PyCQA/pyflakes/pull/532#pullrequestreview-396059622 I've created a small script to reproduce the problem ``` import sys SRC = b"""\ def foo(): ''' def bar(): pass def baz(): '''quux''' """ try: exec(SRC) except SyntaxError as e: print( f'{sys.version}\n\n' f'{type(e).__name__}:\n' f'- line: {e.lineno}\n' f'- offset: {e.offset}\n' f'- text: {e.text!r}\n' ) ``` This was "fixed" in python3.8, but has regressed: ``` $ python3.6 t2.py 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0] SyntaxError: - line: 8 - offset: 52 - text: " '''\n\ndef bar():\n pass\n\ndef baz():\n '''quux'''\n" $ python3.8 t2.py 3.8.2 (default, Feb 26 2020, 02:56:10) [GCC 7.4.0] SyntaxError: - line: 8 - offset: 8 - text: " '''\n\ndef bar():\n pass\n\ndef baz():\n '''quux'''\n" $ ./python t2.py 3.9.0a5+ (heads/master:3955da8568, Apr 19 2020, 14:29:48) [GCC 7.5.0] SyntaxError: - line: 8 - offset: 52 - text: " '''\n\ndef bar():\n pass\n\ndef baz():\n '''quux'''\n" ``` ---------- components: Interpreter Core messages: 366805 nosy: Anthony Sottile priority: normal severity: normal status: open title: Regression in multiline SyntaxError offsets type: behavior versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40335> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com