Message357845
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. |
|
Date |
User |
Action |
Args |
2019-12-05 11:21:41 | blueyed | set | recipients:
+ blueyed, belopolsky, xdegaye, serhiy.storchaka |
2019-12-05 11:21:41 | blueyed | set | messageid: <1575544901.4.0.46373442549.issue24565@roundup.psfhosted.org> |
2019-12-05 11:21:41 | blueyed | link | issue24565 messages |
2019-12-05 11:21:41 | blueyed | create | |
|