René's URL Explorer Experiment


Title: bpo-41631: Check that importing _ast returns the right module by encukou · Pull Request #21973 · python/cpython · GitHub

Open Graph Title: bpo-41631: Check that importing _ast returns the right module by encukou · Pull Request #21973 · python/cpython

X Title: bpo-41631: Check that importing _ast returns the right module by encukou · Pull Request #21973 · python/cpython

Description: Hopefully #21961 will be OK, but if not: here is a relatively minimal fix for bpo-41631, which basically makes compiling to/from AST fail gracefully (with a proper exception rather than a NULL without exception) if the _ast module has been tampered with. For example, it looks like Mercurial's lazy-loading scheme replaces _astwith a proxy object; this will make AST unusable. The second commit deals with a hack in pegen's tests – please review the commits separately, and see comments. https://bugs.python.org/issue41631

Open Graph Description: Hopefully #21961 will be OK, but if not: here is a relatively minimal fix for bpo-41631, which basically makes compiling to/from AST fail gracefully (with a proper exception rather than a NULL with...

X Description: Hopefully #21961 will be OK, but if not: here is a relatively minimal fix for bpo-41631, which basically makes compiling to/from AST fail gracefully (with a proper exception rather than a NULL with...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:bd7cb358-c652-b4fd-806e-e08353f85c79
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA532:87739:4A3A93:68F49C:696A16ED
html-safe-nonce04adbce5e511c74a49d1c483df20b63e99b6027aa15a80ebd82eb772cb5a0d3a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTMyOjg3NzM5OjRBM0E5Mzo2OEY0OUM6Njk2QTE2RUQiLCJ2aXNpdG9yX2lkIjoiMTgxNzcyMDIwMTEzMDE1MzcwOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacd69529edc1e977c414a07fdb4348edcd5a95bdcdd35803dcabc69463a79ace04
hovercard-subject-tagpull_request:474360785
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/21973/files
twitter:imagehttps://avatars.githubusercontent.com/u/302922?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/302922?s=400&v=4
og:image:altHopefully #21961 will be OK, but if not: here is a relatively minimal fix for bpo-41631, which basically makes compiling to/from AST fail gracefully (with a proper exception rather than a NULL with...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None34a52bd10bd674f68e5c1b6b74413b79bf2ca20c551055ace3f7cdd112803923
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
releasee8bd37502700f365b18a4d39acf7cb7947e11b1a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/21973/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F21973%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F21973%2Ffiles
Sign up https://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/21973/files
Reloadhttps://github.com/python/cpython/pull/21973/files
Reloadhttps://github.com/python/cpython/pull/21973/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/21973/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/pull/21973/files
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
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
encukouhttps://github.com/encukou
python:masterhttps://github.com/python/cpython/tree/master
encukou:check-ast-module-def_masterhttps://github.com/encukou/cpython/tree/check-ast-module-def_master
Conversation 4 https://github.com/python/cpython/pull/21973
Commits 4 https://github.com/python/cpython/pull/21973/commits
Checks 0 https://github.com/python/cpython/pull/21973/checks
Files changed https://github.com/python/cpython/pull/21973/files
Please reload this pagehttps://github.com/python/cpython/pull/21973/files
bpo-41631: Check that importing _ast returns the right module https://github.com/python/cpython/pull/21973/files#top
Show all changes 4 commits https://github.com/python/cpython/pull/21973/files
08486b2 bpo-41631: Check that importing _ast returns the right module encukou Aug 26, 2020 https://github.com/python/cpython/pull/21973/commits/08486b2423332cc20becde6f24359872685eb64a
2c36b77 Work around a hack in pegen's tests, an extension that must be treate… encukou Aug 26, 2020 https://github.com/python/cpython/pull/21973/commits/2c36b77cd1a4f3908851c40ae8171fc2e65f3ace
be66256 Update Tools/peg_generator/pegen/build.py encukou Sep 9, 2020 https://github.com/python/cpython/pull/21973/commits/be66256655114d353763a7b2ecd1f5e8d5581d5b
a95c6f7 Don't mention "segfault" from the blurb encukou Sep 9, 2020 https://github.com/python/cpython/pull/21973/commits/a95c6f73fa5daadfe882242261a697cf7f468058
Clear filters https://github.com/python/cpython/pull/21973/files
Please reload this pagehttps://github.com/python/cpython/pull/21973/files
Please reload this pagehttps://github.com/python/cpython/pull/21973/files
test_ast.py https://github.com/python/cpython/pull/21973/files#diff-3f516b60719dd445d33225e4f316b36e85c9c51a843a0147349d11a005c55937
2020-08-26-22-25-25.bpo-41631.RTN8yW.rst https://github.com/python/cpython/pull/21973/files#diff-99e900d791440a4aa3a0aebc84d806e961596562d080ecc247eb74797ab587f4
asdl_c.py https://github.com/python/cpython/pull/21973/files#diff-c4dd13901c011c278fe5b6d175fdd23ed94e51568fe6b2ee4215d5ab376be9a8
Python-ast.c https://github.com/python/cpython/pull/21973/files#diff-0258ad568d1bc0a5fa1c949351df0cc72a0a63441a1ed78c77d59f5695704857
ast_dump.py https://github.com/python/cpython/pull/21973/files#diff-e6f412fc2c096b7ffbdd22680ff5d0292f16a950a1007cc1fcca7cc3ae3e1d52
build.py https://github.com/python/cpython/pull/21973/files#diff-476cab90bd9f052e2ca52fc323d61913145493cfabeda68fff8feeb086728a9a
Lib/test/test_ast.pyhttps://github.com/python/cpython/pull/21973/files#diff-3f516b60719dd445d33225e4f316b36e85c9c51a843a0147349d11a005c55937
View file https://github.com/encukou/cpython/blob/a95c6f73fa5daadfe882242261a697cf7f468058/Lib/test/test_ast.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/21973/{{ revealButtonHref }}
https://github.com/python/cpython/pull/21973/files#diff-3f516b60719dd445d33225e4f316b36e85c9c51a843a0147349d11a005c55937
https://github.com/python/cpython/pull/21973/files#diff-3f516b60719dd445d33225e4f316b36e85c9c51a843a0147349d11a005c55937
Misc/NEWS.d/next/Core and Builtins/2020-08-26-22-25-25.bpo-41631.RTN8yW.rsthttps://github.com/python/cpython/pull/21973/files#diff-99e900d791440a4aa3a0aebc84d806e961596562d080ecc247eb74797ab587f4
View file https://github.com/encukou/cpython/blob/a95c6f73fa5daadfe882242261a697cf7f468058/Misc/NEWS.d/next/Core%20and%20Builtins/2020-08-26-22-25-25.bpo-41631.RTN8yW.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/21973/{{ revealButtonHref }}
Parser/asdl_c.pyhttps://github.com/python/cpython/pull/21973/files#diff-c4dd13901c011c278fe5b6d175fdd23ed94e51568fe6b2ee4215d5ab376be9a8
View file https://github.com/encukou/cpython/blob/a95c6f73fa5daadfe882242261a697cf7f468058/Parser/asdl_c.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/21973/{{ revealButtonHref }}
https://github.com/python/cpython/pull/21973/files#diff-c4dd13901c011c278fe5b6d175fdd23ed94e51568fe6b2ee4215d5ab376be9a8
https://github.com/python/cpython/pull/21973/files#diff-c4dd13901c011c278fe5b6d175fdd23ed94e51568fe6b2ee4215d5ab376be9a8
https://github.com/python/cpython/pull/21973/files#diff-c4dd13901c011c278fe5b6d175fdd23ed94e51568fe6b2ee4215d5ab376be9a8
Python/Python-ast.chttps://github.com/python/cpython/pull/21973/files#diff-0258ad568d1bc0a5fa1c949351df0cc72a0a63441a1ed78c77d59f5695704857
View file https://github.com/encukou/cpython/blob/a95c6f73fa5daadfe882242261a697cf7f468058/Python/Python-ast.c
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/python/cpython/pull/21973/files
Tools/peg_generator/pegen/ast_dump.pyhttps://github.com/python/cpython/pull/21973/files#diff-e6f412fc2c096b7ffbdd22680ff5d0292f16a950a1007cc1fcca7cc3ae3e1d52
View file https://github.com/encukou/cpython/blob/a95c6f73fa5daadfe882242261a697cf7f468058/Tools/peg_generator/pegen/ast_dump.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/21973/{{ revealButtonHref }}
https://github.com/python/cpython/pull/21973/files#diff-e6f412fc2c096b7ffbdd22680ff5d0292f16a950a1007cc1fcca7cc3ae3e1d52
https://github.com/python/cpython/pull/21973/files#diff-e6f412fc2c096b7ffbdd22680ff5d0292f16a950a1007cc1fcca7cc3ae3e1d52
Tools/peg_generator/pegen/build.pyhttps://github.com/python/cpython/pull/21973/files#diff-476cab90bd9f052e2ca52fc323d61913145493cfabeda68fff8feeb086728a9a
View file https://github.com/encukou/cpython/blob/a95c6f73fa5daadfe882242261a697cf7f468058/Tools/peg_generator/pegen/build.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/21973/{{ revealButtonHref }}
https://github.com/python/cpython/pull/21973/files#diff-476cab90bd9f052e2ca52fc323d61913145493cfabeda68fff8feeb086728a9a
https://github.com/python/cpython/pull/21973/files#diff-476cab90bd9f052e2ca52fc323d61913145493cfabeda68fff8feeb086728a9a
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.