[issue24565] the f_lineno getter is broken
daniel hahler
report at bugs.python.org
Thu Dec 5 06:21:41 EST 2019
daniel hahler <python-bugs at thequod.de> added the comment:
This is likely covered by existing/linked issues already, but wanted to leave it here nonetheless:
Given t-pdb.py:
```
import sys
def main():
sys.stdout.write("main...\n")
assert 0
if __name__ == "__main__":
main()
```
Without the fix from the PR:
```
% python3.8 -m pdb -c cont t-pdb.py
main...
Traceback (most recent call last):
File "…/pyenv/3.8.0/lib/python3.8/pdb.py", line 1702, in main
pdb._runscript(mainpyfile)
File "…/pyenv/3.8.0/lib/python3.8/pdb.py", line 1571, in _runscript
self.run(statement)
File "…/pyenv/3.8.0/lib/python3.8/bdb.py", line 587, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "…/Vcs/cpython/t-pdb.py", line 1, in <module>
import sys
File "…/Vcs/cpython/t-pdb.py", line 6, in main
assert 0
AssertionError
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> …/Vcs/cpython/t-pdb.py(6)main()
-> assert 0
(Pdb)
```
With the fix:
```
% /tmp/cpython-bisect/bin/python3.8 -m pdb -c cont t-pdb.py
main...
Traceback (most recent call last):
File "/tmp/cpython-bisect/lib/python3.8/pdb.py", line 1703, in main
pdb._runscript(mainpyfile)
File "/tmp/cpython-bisect/lib/python3.8/pdb.py", line 1572, in _runscript
self.run(statement)
File "/tmp/cpython-bisect/lib/python3.8/bdb.py", line 583, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "…/Vcs/cpython/t-pdb.py", line 10, in <module>
main()
File "…/Vcs/cpython/t-pdb.py", line 6, in main
assert 0
AssertionError
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> …/Vcs/cpython/t-pdb.py(6)main()
-> assert 0
(Pdb)
```
As you can see the traceback in the fixed case contains `main()` correctly,
while it has `import sys` (the scripts first line) otherwise.
I can only repeat myself to ask for reviewing/merging https://github.com/python/cpython/pull/12419.
----------
nosy: +blueyed
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue24565>
_______________________________________
More information about the Python-bugs-list
mailing list