Bruno P. Kinoshita <brunodepau...@yahoo.com.br> 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/cpython$ python Python 3.9.0a0 (heads/master:b530a4460b, Jul 22 2019, 18:38:44) [GCC 7.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> kinow@localhost:~/Development/python/workspace/cpython$ python z.py Traceback (most recent call last): File "/home/kinow/Development/python/workspace/cpython/z.py", line 14, in <module> print(list(raise_generator())) File "/home/kinow/Development/python/workspace/cpython/z.py", line 7, in raise_generator yield 'three values are: %s %s %s' % ( File "/home/kinow/Development/python/workspace/cpython/z.py", line 3, in __str__ raise ValueError('Z error') ValueError: Z error ``` It is now displaying the line number 7, where the yield statement begins, instead of where it actually happened (line 9). And once again, if I replace `Z()` by `Z().__str__()`, then it displays the right line number. ``` kinow@localhost:~/Development/python/workspace/cpython$ python z.py Traceback (most recent call last): File "/home/kinow/Development/python/workspace/cpython/z.py", line 14, in <module> print(list(raise_generator())) File "/home/kinow/Development/python/workspace/cpython/z.py", line 9, in raise_generator Z().__str__(), # traceback must point to this lineno 9 File "/home/kinow/Development/python/workspace/cpython/z.py", line 3, in __str__ raise ValueError('Z error') ValueError: Z error ``` ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37647> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com