<!-- If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not the right place to seek help. Consider the following options instead: - reading the Python tutorial: https://docs.python.org/3/tutorial/ - posting in the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7 - emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list - searching our issue tracker (https://github.com/python/cpython/issues) to see if your problem has already been reported --> # Bug report 1. Create `foo.py` containing `a = 1` 2. `./python -m pdb foo.py` Results in ``` ./python -m pdb foo.py ./foo.py(1)<module>() -> a = 1 (Pdb) longlist 0 a = 1 (Pdb) ``` The line number should be `1` instead of `0`. This occurs because the `longlist` command uses `inspect.getsourcelines`, which returns `0` as the starting line number for modules. This bug was introduced in https://github.com/python/cpython/pull/101674. # Your environment - CPython versions tested on: `main` <!-- gh-linked-prs --> ### Linked PRs * gh-103226 * gh-103265 * gh-104262 <!-- /gh-linked-prs -->
Activity
pythonGH-103225: Fix `inspect.getsourcelines()` to return 1-based lin…
gh-103225: Fixed zero lineno issue for pdb (#103265)
pythongh-103225: Fixed zero lineno issue for pdb (python#103265)
pythongh-103225: Fixed zero lineno issue for pdb (python#103265)
[3.11] gh-103225: Fixed zero lineno issue for pdb (#103265) (#104262)
hauntsaninja commentedon May 8, 2023
Thanks for reporting! Closing, since the pdb issue is fixed and #103319 can track whether we want to change behaviour in inspect or not