classification
Title: Parser: broken line numbers for triple-quoted strings
Type: Stage: resolved
Components: Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder: col_offset is -1 and lineno is wrong for multiline string expressions
View: 16806
Assigned To: Nosy List: benjamin.peterson, serhiy.storchaka, skrah, vstinner
Priority: normal Keywords:

Created on 2015-07-12 19:41 by skrah, last changed 2015-11-16 15:24 by serhiy.storchaka. This issue is now closed.

Messages (3)
msg246665 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2015-07-12 19:41
IMO the string should start at lineno=1, col_offset=0.


$ ./python 
Python 3.6.0a0 (default:02b81a82a57d, Jul 12 2015, 20:33:44) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> a = ast.parse('''"""xxx
... yyy
... zzz"""''')
>>> ast.dump(a, include_attributes=True)
"Module(body=[Expr(value=Str(s='xxx\\nyyy\\nzzz', lineno=3, col_offset=-1), lineno=3, col_offset=-1)])"
msg254116 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2015-11-05 16:41
Victor, I'm adding you just in case this also affects your
optimizer (like #25555).
msg254738 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-11-16 15:24
This is a duplicate of issue16806
History
Date User Action Args
2015-11-16 15:24:15serhiy.storchakasetstatus: open -> closed

superseder: col_offset is -1 and lineno is wrong for multiline string expressions

nosy: + serhiy.storchaka
messages: + msg254738
resolution: duplicate
stage: resolved
2015-11-05 16:41:30skrahsetnosy: + vstinner
2015-11-05 16:41:20skrahsetmessages: + msg254116
2015-07-12 19:42:12skrahsetnosy: + benjamin.peterson
2015-07-12 19:41:18skrahcreate