Title: Lazy import traceback points to another module's declaration · Issue #158597 · python/cpython · GitHub
Open Graph Title: Lazy import traceback points to another module's declaration · Issue #158597 · python/cpython
X Title: Lazy import traceback points to another module's declaration · Issue #158597 · python/cpython
Description: With #158521 applied: A.py: lazy import xml.missing import B xml.missing B.py: lazy import xml.missing Run python A.py. The chained ImportError points to B.py:1, but it should point to the declaration in A.py:1. Reproduced on 3.16.0a0, L...
Open Graph Description: With #158521 applied: A.py: lazy import xml.missing import B xml.missing B.py: lazy import xml.missing Run python A.py. The chained ImportError points to B.py:1, but it should point to the declarat...
X Description: With #158521 applied: A.py: lazy import xml.missing import B xml.missing B.py: lazy import xml.missing Run python A.py. The chained ImportError points to B.py:1, but it should point to the declarat...
Opengraph URL: https://github.com/python/cpython/issues/158597
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Lazy import traceback points to another module's declaration","articleBody":"With #158521 applied:\n\n`A.py`:\n```python\nlazy import xml.missing\nimport B\n\nxml.missing\n```\n\n`B.py`:\n```python\nlazy import xml.missing\n```\n\nRun `python A.py`. The chained `ImportError` points to `B.py:1`, but it should point to the declaration in `A.py:1`.\n\nReproduced on 3.16.0a0, Linux. Follow-up to [the discussion on #158521](https://github.com/python/cpython/pull/158521#issuecomment-5951557148).\n\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-159476\n* gh-162389\n* gh-162392\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/pablogsal","@type":"Person","name":"pablogsal"},"datePublished":"2026-10-02T12:21:26Z","url":"https://github.com/python/cpython/issues/158597"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:70b708ac-ed12-ce3a-4b0f-1e016175a067 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D17C:FC5BE:31EEE39:425905B:6B01EC28 |
| html-safe-nonce | 5cd903afd73107ecdc8e32ebb8319ce2e215f87076b2a6ed4ed4f670dcd3a615 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTdDOkZDNUJFOjMxRUVFMzk6NDI1OTA1Qjo2QjAxRUMyOCIsInZpc2l0b3JfaWQiOiIyNDAzNDE5NTc0MTQyODg5MDAwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 004f3e20df8503f24bacef39ca53a60d2186260d23f54ea54d9b5d50e68c5a7d |
| hovercard-subject-tag | issue:5677295229 |
| 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/158597/issue_layout |
| twitter:image | https://opengraph.githubassets.com/274dad6a12b72388b0f67331d260e1e11a3137f7ec3c76df72a4c3f45f17411e/python/cpython/issues/158597 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/274dad6a12b72388b0f67331d260e1e11a3137f7ec3c76df72a4c3f45f17411e/python/cpython/issues/158597 |
| og:image:alt | With #158521 applied: A.py: lazy import xml.missing import B xml.missing B.py: lazy import xml.missing Run python A.py. The chained ImportError points to B.py:1, but it should point to the declarat... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pablogsal |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width