[issue37647] Wrong lineno in traceback when formatting strings with % and multilines

2019-07-22 Thread Bruno P. Kinoshita
Bruno P. Kinoshita added the comment: Hi, Thanks for the explanation. Could you elaborate a bit on this one: >In Python 3.8 the traceback points to the start of the subexpression that >raises an exception. Just wanted to understand why I get the desired line number when I call Z().__str__(

[issue37647] Wrong lineno in traceback when formatting strings with % and multilines

2019-07-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Line 9 is not where the error actually happened. The exception is raised not when you call Z(), but when you implicitly call Z.__str__() when evaluate the % operator. In Python 3.8 the traceback points to the start of the subexpression that raises an exce

[issue37647] Wrong lineno in traceback when formatting strings with % and multilines

2019-07-21 Thread Bruno P. Kinoshita
Bruno P. Kinoshita added the comment: Hi Ammar, thanks for the quick reply and for the suggestion. Tried on the latest version on master, and looks like it's indeed different, though still looks like it is displaying the wrong line number. ``` kinow@localhost:~/Development/python/workspace/c

[issue37647] Wrong lineno in traceback when formatting strings with % and multilines

2019-07-21 Thread Ammar Askar
Ammar Askar added the comment: Please try this on the latest version of Python, there was a behavior change implemented in issue12458 that might make this a non-issue. -- nosy: +ammar2, serhiy.storchaka ___ Python tracker

[issue37647] Wrong lineno in traceback when formatting strings with % and multilines

2019-07-21 Thread Bruno P. Kinoshita
New submission from Bruno P. Kinoshita : Hi, Tested on Python 3.7 on Ubuntu LTS. But I believe this affects previous versions too, as found it from an issue posted in Jinja2 in 2013: https://github.com/pallets/jinja/issues/276 This code simulates the issue where the traceback has the wrong l