Title: pdb shows wrong line numbers for modules · Issue #103225 · python/cpython · GitHub
Open Graph Title: pdb shows wrong line numbers for modules · Issue #103225 · python/cpython
X Title: pdb shows wrong line numbers for modules · Issue #103225 · python/cpython
Description: Bug report Create foo.py containing a = 1 ./python -m pdb foo.py Results in ./python -m pdb foo.py ./foo.py(1)
Open Graph Description: Bug report Create foo.py containing a = 1 ./python -m pdb foo.py Results in ./python -m pdb foo.py ./foo.py(1)
X Description: Bug report Create foo.py containing a = 1 ./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 i...
Opengraph URL: https://github.com/python/cpython/issues/103225
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pdb shows wrong line numbers for modules","articleBody":"\u003c!--\r\n 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\r\n the right place to seek help. Consider the following options instead:\r\n\r\n - reading the Python tutorial: https://docs.python.org/3/tutorial/\r\n - posting in the \"Users\" category on discuss.python.org: https://discuss.python.org/c/users/7\r\n - emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list\r\n - searching our issue tracker (https://github.com/python/cpython/issues) to see if\r\n your problem has already been reported\r\n--\u003e\r\n\r\n# Bug report\r\n\r\n1. Create `foo.py` containing `a = 1`\r\n2. `./python -m pdb foo.py`\r\n\r\nResults in\r\n```\r\n./python -m pdb foo.py\r\n./foo.py(1)\u003cmodule\u003e()\r\n-\u003e a = 1\r\n(Pdb) longlist\r\n 0 a = 1\r\n(Pdb) \r\n```\r\n\r\nThe line number should be `1` instead of `0`.\r\n\r\nThis occurs because the `longlist` command uses `inspect.getsourcelines`, which returns `0` as the starting line number for modules.\r\n\r\nThis bug was introduced in https://github.com/python/cpython/pull/101674.\r\n\r\n# Your environment\r\n\r\n\r\n- CPython versions tested on: `main`\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-103226\n* gh-103265\n* gh-104262\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/artemmukhin","@type":"Person","name":"artemmukhin"},"datePublished":"2023-04-03T21:31:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/103225/cpython/issues/103225"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b6db0382-540f-111a-a97d-0680020a5b9a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8152:33AD3C:29FF9:35F4C:696B3167 |
| html-safe-nonce | a38191969ec7c17d7b173f357c148009049a4a2902bad0638a547519eaf61f40 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTUyOjMzQUQzQzoyOUZGOTozNUY0Qzo2OTZCMzE2NyIsInZpc2l0b3JfaWQiOiI0NTI4MDcwNjYwNTc0NjIyMDU1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | cc5a33e55cadf32af2a395e3d2513c1cc648755a06b04a11438773fd3fd3320d |
| hovercard-subject-tag | issue:1652804872 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/103225/issue_layout |
| twitter:image | https://opengraph.githubassets.com/91e0861980802d8ff318b255909fa90bbedaf7adc58ce093f2b6ad6b727c0c9f/python/cpython/issues/103225 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/91e0861980802d8ff318b255909fa90bbedaf7adc58ce093f2b6ad6b727c0c9f/python/cpython/issues/103225 |
| og:image:alt | Bug report Create foo.py containing a = 1 ./python -m pdb foo.py Results in ./python -m pdb foo.py ./foo.py(1) |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | artemmukhin |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width