René's URL Explorer Experiment


Title: gh-106922: Support multi-line error locations in traceback by williamwen42 · Pull Request #109589 · python/cpython · GitHub

Open Graph Title: gh-106922: Support multi-line error locations in traceback by williamwen42 · Pull Request #109589 · python/cpython

X Title: gh-106922: Support multi-line error locations in traceback by williamwen42 · Pull Request #109589 · python/cpython

Description: Complete implementation for #106922. Implementing (1) requires substantial changes for an implementation of (2) or (3), so I just did it all in one go. Some changes compared to the initial issue: We do not always output all lines that correspond to an error: If locations are missing, we only output the first line (missing locations assumes we only want to output one line) If there are too many lines to output, in order to declutter output, we only output "significant lines" - the first and last lines, and the beginning and the end of the anchors, and 1 line above and below these lines (see tests for examples, e.g. test_many_lines_binary_op). Order of looking things in the PR: traceback.py Changes to FrameSummary fields Changes to the traceback printing algorithm, primarily format_frame_summary and _extract_caret_anchors_from_line_segment - comments should sufficiently explain the algorithm traceback.c Algorithm essentially mirrors traceback.py - comments should sufficiently explain the algorithm I needed to write my own implementation for dedent and for tracking significant lines (struct SignificantLines i.e. a set). If there are existing implementations, then I would be happy to use those instead. test_traceback.c Change some tests to check for multi-line outputs. Add some new multi-line tests. Other testing files Change some tests to check for multi-line outputs. cc @pablogsal @isidentical @ammaraskar @iritkatriel @ezyang Issue: gh-106922

Open Graph Description: Complete implementation for #106922. Implementing (1) requires substantial changes for an implementation of (2) or (3), so I just did it all in one go. Some changes compared to the initial issue: W...

X Description: Complete implementation for #106922. Implementing (1) requires substantial changes for an implementation of (2) or (3), so I just did it all in one go. Some changes compared to the initial issue: W...

Opengraph URL: https://github.com/python/cpython/pull/109589

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:483e9ff6-e4b0-6eff-8d31-9a9899c2e883
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idEC3C:12476C:17622E6:1EA9CDB:6B001680
html-safe-nonce75f589bdfe3133f7f0d624291541c5b8c9d09bc2ff8daeac93cef6b529b1c685
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzNDOjEyNDc2QzoxNzYyMkU2OjFFQTlDREI6NkIwMDE2ODAiLCJ2aXNpdG9yX2lkIjoiODM5OTQyODczODEwNTc0Mjk3NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac1cad7196c61b72b579a0d891b9577faa58243008c9bb528d16c27a41099d1b82
hovercard-subject-tagpull_request:1522130197
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/109589/files
twitter:imagehttps://avatars.githubusercontent.com/u/20119138?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/20119138?s=400&v=4
og:image:altComplete implementation for #106922. Implementing (1) requires substantial changes for an implementation of (2) or (3), so I just did it all in one go. Some changes compared to the initial issue: W...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonea2dd2291b1b13cc9c06f27ec92fa3dbaf34116fc24c9347b8539db61884c59f4
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release70121d4e855ee0bb7b75cf15d061d91f8863c0f8
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/109589/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F109589%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F109589%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/109589/files
Reloadhttps://github.com/python/cpython/pull/109589/files
Reloadhttps://github.com/python/cpython/pull/109589/files
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
williamwen42https://github.com/williamwen42
python:mainhttps://github.com/python/cpython/tree/main
williamwen42:multiline-traceback-2https://github.com/williamwen42/cpython/tree/multiline-traceback-2
Conversation 10 https://github.com/python/cpython/pull/109589
Commits 14 https://github.com/python/cpython/pull/109589/commits
Checks 0 https://github.com/python/cpython/pull/109589/checks
Files changed https://github.com/python/cpython/pull/109589/files
Please reload this pagehttps://github.com/python/cpython/pull/109589/files
gh-106922: Support multi-line error locations in traceback https://github.com/python/cpython/pull/109589/files#top
Show all changes 14 commits https://github.com/python/cpython/pull/109589/files
20da582 update traceback.c williamwen42 Jul 27, 2023 https://github.com/python/cpython/pull/109589/commits/20da58269741459dbee6cd3bee77c88e5408b34b
2e63abc update tests and traceback.py williamwen42 Jul 29, 2023 https://github.com/python/cpython/pull/109589/commits/2e63abc96106b7e0eaa43ce60afa1184a6ce551f
db094ed wip more updates to traceback.c williamwen42 Aug 3, 2023 https://github.com/python/cpython/pull/109589/commits/db094ed4c5469e188bb407f445c4f052121b0abe
5d8ceff wip more updates to traceback.c williamwen42 Aug 18, 2023 https://github.com/python/cpython/pull/109589/commits/5d8cefff378427ae200ee11c8ccd0c548eaace66
f35d975 wip done initial traceback.c implementation williamwen42 Sep 13, 2023 https://github.com/python/cpython/pull/109589/commits/f35d975a35ca3b8be6d99d8996b0d37a88ead590
9d02a5c initial review williamwen42 Sep 15, 2023 https://github.com/python/cpython/pull/109589/commits/9d02a5cbac4c4096bc33cacc6fb334fa5ed6e5f8
91fcb73 fix issues - get tests passing williamwen42 Sep 18, 2023 https://github.com/python/cpython/pull/109589/commits/91fcb73b14ca0a9c5337bf89ff7ec80be9e72802
d155d35 add function call traceback tests williamwen42 Sep 18, 2023 https://github.com/python/cpython/pull/109589/commits/d155d35ed18e6505ac63a9fa1deee4b9987bff1c
7bee8ba add more tests williamwen42 Sep 18, 2023 https://github.com/python/cpython/pull/109589/commits/7bee8ba564eef9dabc378a1277b07897a9aca977
34a5755 make outputs abbreviated, only output 1 line when location informatio… williamwen42 Sep 19, 2023 https://github.com/python/cpython/pull/109589/commits/34a5755ec54415126eb8638065eb001c1f22f692
2fcbea7 fix other failing tests williamwen42 Sep 19, 2023 https://github.com/python/cpython/pull/109589/commits/2fcbea7da7da7a2fb7c0de126eadaa6320ab3b48
e4b978d fix smelly symbol williamwen42 Sep 20, 2023 https://github.com/python/cpython/pull/109589/commits/e4b978ddc34f793fea18e6145996b4269f7fd69f
26fd2d9 small fixes williamwen42 Sep 21, 2023 https://github.com/python/cpython/pull/109589/commits/26fd2d9a0c3f6486eaa231d7c5976d7e745be851
bd8a837 📜🤖 Added by blurb_it. blurb-it[bot] Sep 21, 2023 https://github.com/python/cpython/pull/109589/commits/bd8a837b0838ad76a049d7399505b4bc4dadbc35
Clear filters https://github.com/python/cpython/pull/109589/files
Please reload this pagehttps://github.com/python/cpython/pull/109589/files
Please reload this pagehttps://github.com/python/cpython/pull/109589/files
test_contextlib.py https://github.com/python/cpython/pull/109589/files#diff-36de20f5f33e93654722aa17ba15b51aa3f58c573c477d69856069944db7994f
test_doctest.py https://github.com/python/cpython/pull/109589/files#diff-2752e009dea2759fb0a5a0866446e8bbd3f5ed30c030b26d252d7a1178b413e7
test_exceptions.py https://github.com/python/cpython/pull/109589/files#diff-3dbd58a46964dc5908595a1caa552fa3f5e2e46610679634ffc1064fd7cc3c8f
test_traceback.py https://github.com/python/cpython/pull/109589/files#diff-8a52124ffceebd98f91bf96caa0f341ae109f79e190cd5acc1c56c8968d75252
traceback.py https://github.com/python/cpython/pull/109589/files#diff-96634ca56022c201d0ff677e922810a97e4ad8a55de53258cf0cbc22bd7c9be1
2023-09-21-22-41-45.gh-issue-106922.qslOVH.rst https://github.com/python/cpython/pull/109589/files#diff-13945ba05936ff0a45717f975427c94686cfbb3e6c49e032526ee2f0903c8c3e
traceback.c https://github.com/python/cpython/pull/109589/files#diff-8bca5f3e0435e43986da8b0359c72b3c60915101d3c0c84d27009eb8c15918f7
Lib/test/test_contextlib.pyhttps://github.com/python/cpython/pull/109589/files#diff-36de20f5f33e93654722aa17ba15b51aa3f58c573c477d69856069944db7994f
View file https://github.com/williamwen42/cpython/blob/bd8a837b0838ad76a049d7399505b4bc4dadbc35/Lib/test/test_contextlib.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/109589/{{ revealButtonHref }}
https://github.com/python/cpython/pull/109589/files#diff-36de20f5f33e93654722aa17ba15b51aa3f58c573c477d69856069944db7994f
https://github.com/python/cpython/pull/109589/files#diff-36de20f5f33e93654722aa17ba15b51aa3f58c573c477d69856069944db7994f
Lib/test/test_doctest.pyhttps://github.com/python/cpython/pull/109589/files#diff-2752e009dea2759fb0a5a0866446e8bbd3f5ed30c030b26d252d7a1178b413e7
View file https://github.com/williamwen42/cpython/blob/bd8a837b0838ad76a049d7399505b4bc4dadbc35/Lib/test/test_doctest.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/109589/{{ revealButtonHref }}
https://github.com/python/cpython/pull/109589/files#diff-2752e009dea2759fb0a5a0866446e8bbd3f5ed30c030b26d252d7a1178b413e7
https://github.com/python/cpython/pull/109589/files#diff-2752e009dea2759fb0a5a0866446e8bbd3f5ed30c030b26d252d7a1178b413e7
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L247
Lib/test/test_exceptions.pyhttps://github.com/python/cpython/pull/109589/files#diff-3dbd58a46964dc5908595a1caa552fa3f5e2e46610679634ffc1064fd7cc3c8f
View file https://github.com/williamwen42/cpython/blob/bd8a837b0838ad76a049d7399505b4bc4dadbc35/Lib/test/test_exceptions.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/109589/{{ revealButtonHref }}
https://github.com/python/cpython/pull/109589/files#diff-3dbd58a46964dc5908595a1caa552fa3f5e2e46610679634ffc1064fd7cc3c8f
https://github.com/python/cpython/pull/109589/files#diff-3dbd58a46964dc5908595a1caa552fa3f5e2e46610679634ffc1064fd7cc3c8f
Please reload this pagehttps://github.com/python/cpython/pull/109589/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.