René's URL Explorer Experiment


Title: gh-161918: Correct the documented type of `LogRecord`'s `exc_info` parameter by SelmanBoray · Pull Request #162179 · python/cpython · GitHub

Open Graph Title: gh-161918: Correct the documented type of `LogRecord`'s `exc_info` parameter by SelmanBoray · Pull Request #162179 · python/cpython

X Title: gh-161918: Correct the documented type of `LogRecord`'s `exc_info` parameter by SelmanBoray · Pull Request #162179 · python/cpython

Description: The LogRecord documentation gives the type of exc_info as tuple[type[BaseException], BaseException, types.TracebackType] | None. As reported in #161918, records created by the normal logging methods can hold two shapes that this type excludes: logger.error("msg", exc_info=True) outside an except block stores (None, None, None), because Logger._log() passes on what sys.exc_info() returns. logger.error("msg", exc_info=ValueError()) stores a tuple whose traceback is None, because the exception was never raised. This changes the documented type to tuple[type[BaseException], BaseException, types.TracebackType | None] | tuple[None, None, None] | None. That is what Logger._log() produces on main, it agrees with the adjacent description ("as returned by sys.exc_info()"), and it matches the typeshed annotation. Documentation only, one line, no behaviour change. This covers only the LogRecord parameter type. The other questions in #161918 (what makeLogRecord() and Logger.makeRecord() accept, Formatter.formatException(), stack_info) are not addressed, so this does not close the issue. The exc_info row of the "LogRecord attributes" table is left as it is. Checks, on Windows with Python 3.12.10: HTML build of Doc/ with Sphinx 9.1.1 (dependencies from Doc/requirements.txt, options --nitpicky --keep-going): the build succeeds with no warnings for library/logging.rst, and the rendered parameter shows the full type. The only warnings in the full build are nitpicky missing-reference warnings in other files. sphinx-lint --enable=default-role (1.0.2) on Doc/library/logging.rst: no problems found. The reproduction from the issue, run on Python 3.12.10, prints (None, None, None) and (, ValueError(), None). The same branch of Logger._log() is present in Lib/logging/__init__.py on main. Not done: CPython main was not built or run, and Doc/tools/check-warnings.py was not run (it expects POSIX path separators in the warnings file). AI disclosure: this pull request was prepared and opened by an AI coding agent (Claude Code) on behalf of the account owner. The agent wrote the change and ran the checks listed above; the account owner approved opening it but has not manually tested it. Follow-up commits may also come from the agent; replies posted here are approved by the account owner before they are sent. Issue: gh-161918

Open Graph Description: The LogRecord documentation gives the type of exc_info as tuple[type[BaseException], BaseException, types.TracebackType] | None. As reported in #161918, records created by the normal logging method...

X Description: The LogRecord documentation gives the type of exc_info as tuple[type[BaseException], BaseException, types.TracebackType] | None. As reported in #161918, records created by the normal logging method...

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

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:917a2047-2dba-acfb-7b1e-678b1a48228c
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB0FA:1AD4B2:77096:A20CB:6B0018E8
html-safe-nonce8cbf0a86447ff07f6dc49f3543ae51b29efa661e2beb5a39cffd8d67798b489d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMEZBOjFBRDRCMjo3NzA5NjpBMjBDQjo2QjAwMThFOCIsInZpc2l0b3JfaWQiOiI3NTA0NjQ0MDIzNjQzMDE5NDk2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacecc58d9b7bbb46eb3de9cb6a88086f9f917c14b51ff03d6bc097039f0b6c3a44
hovercard-subject-tagpull_request:5365890262
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/162179/files
twitter:imagehttps://avatars.githubusercontent.com/u/237838469?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/237838469?s=400&v=4
og:image:altThe LogRecord documentation gives the type of exc_info as tuple[type[BaseException], BaseException, types.TracebackType] | None. As reported in #161918, records created by the normal logging method...
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
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/162179/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F162179%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%2F162179%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/162179/files
Reloadhttps://github.com/python/cpython/pull/162179/files
Reloadhttps://github.com/python/cpython/pull/162179/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
SelmanBorayhttps://github.com/SelmanBoray
python:mainhttps://github.com/python/cpython/tree/main
SelmanBoray:docs/logrecord-exc-info-type-161918https://github.com/SelmanBoray/cpython/tree/docs/logrecord-exc-info-type-161918
Conversation 3 https://github.com/python/cpython/pull/162179
Commits 1 https://github.com/python/cpython/pull/162179/commits
Checks 33 https://github.com/python/cpython/pull/162179/checks
Files changed https://github.com/python/cpython/pull/162179/files
Please reload this pagehttps://github.com/python/cpython/pull/162179/files
gh-161918: Correct the documented type of LogRecord's exc_info parameter https://github.com/python/cpython/pull/162179/files#top
Show all changes 1 commit https://github.com/python/cpython/pull/162179/files
4b4d7cf gh-161918: Correct the documented type of `LogRecord`'s `exc_info` pa… SelmanBoray Nov 16, 2026 https://github.com/python/cpython/pull/162179/commits/4b4d7cfd856bc4d73fce033d5bb47713d00616e9
Clear filters https://github.com/python/cpython/pull/162179/files
Please reload this pagehttps://github.com/python/cpython/pull/162179/files
Please reload this pagehttps://github.com/python/cpython/pull/162179/files
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L535
Doc/library/logging.rsthttps://github.com/python/cpython/pull/162179/files#diff-5a71f910c8cd3cfddb8eb3d3e938b3ff7deaf2ba57f71d91e4b9dbdc58d890fb
View file https://github.com/python/cpython/blob/4b4d7cfd856bc4d73fce033d5bb47713d00616e9/Doc/library/logging.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/162179/{{ revealButtonHref }}
https://github.com/python/cpython/pull/162179/files#diff-5a71f910c8cd3cfddb8eb3d3e938b3ff7deaf2ba57f71d91e4b9dbdc58d890fb
https://github.com/python/cpython/pull/162179/files#diff-5a71f910c8cd3cfddb8eb3d3e938b3ff7deaf2ba57f71d91e4b9dbdc58d890fb
Please reload this pagehttps://github.com/python/cpython/pull/162179/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.