René's URL Explorer Experiment


Title: gh-126835: Move constant unaryop & binop folding to CFG by WolframAlph · Pull Request #129550 · python/cpython · GitHub

Open Graph Title: gh-126835: Move constant unaryop & binop folding to CFG by WolframAlph · Pull Request #129550 · python/cpython

X Title: gh-126835: Move constant unaryop & binop folding to CFG by WolframAlph · Pull Request #129550 · python/cpython

Description: Issue: gh-126835 This PR migrates: Unary ops optimizations from AST to CFG. All binary ops optimizations from AST to CFG except for string formatting. FTR: #126835 (comment) cc @Eclips4 @tomasr8

Open Graph Description: Issue: gh-126835 This PR migrates: Unary ops optimizations from AST to CFG. All binary ops optimizations from AST to CFG except for string formatting. FTR: #126835 (comment) cc @Eclips4 @tomasr8

X Description: Issue: gh-126835 This PR migrates: Unary ops optimizations from AST to CFG. All binary ops optimizations from AST to CFG except for string formatting. FTR: #126835 (comment) cc @Eclips4 @tomasr8

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:42149399-305a-3bcb-8ec2-397019d05809
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id92DA:1DB9:6B9373:93958D:6992EFF2
html-safe-nonce8e12d2a94b9f4eff7ef31d02ce9d7c6be3dcecf1134c9ac9c0ad794c71d8cdd9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MkRBOjFEQjk6NkI5MzczOjkzOTU4RDo2OTkyRUZGMiIsInZpc2l0b3JfaWQiOiI1MTAxNzc3NTU3MTU5ODY2MzU0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacd8271b372f773ab57e0238bedd9e02a3e4832eccd9187f719da05b453c76610f
hovercard-subject-tagpull_request:2310834490
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/129550/files
twitter:imagehttps://avatars.githubusercontent.com/u/46005801?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/46005801?s=400&v=4
og:image:altIssue: gh-126835 This PR migrates: Unary ops optimizations from AST to CFG. All binary ops optimizations from AST to CFG except for string formatting. FTR: #126835 (comment) cc @Eclips4 @tomasr8
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None01ab16879a3159e6f0717ab948b9b562e162a6aafd1f4393b786b07b747df244
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
releaseb1570f3928bef80fa5fc7890ce0942e9b696ad9d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/129550/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F129550%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%2F129550%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/129550/files
Reloadhttps://github.com/python/cpython/pull/129550/files
Reloadhttps://github.com/python/cpython/pull/129550/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/129550/files
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 34.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.5k 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 0 https://github.com/python/cpython/security
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
iritkatrielhttps://github.com/iritkatriel
python:mainhttps://github.com/python/cpython/tree/main
WolframAlph:fold-binop-cfghttps://github.com/WolframAlph/cpython/tree/fold-binop-cfg
Conversation 126 https://github.com/python/cpython/pull/129550
Commits 35 https://github.com/python/cpython/pull/129550/commits
Checks 43 https://github.com/python/cpython/pull/129550/checks
Files changed https://github.com/python/cpython/pull/129550/files
Please reload this pagehttps://github.com/python/cpython/pull/129550/files
gh-126835: Move constant unaryop & binop folding to CFG https://github.com/python/cpython/pull/129550/files#top
Show all changes 35 commits https://github.com/python/cpython/pull/129550/files
04b4a84 move binop folding to cfg WolframAlph Feb 14, 2025 https://github.com/python/cpython/pull/129550/commits/04b4a847f2c0b98f9fe477491e5695ff07ed3bb9
a6babab update tests WolframAlph Feb 14, 2025 https://github.com/python/cpython/pull/129550/commits/a6babab7964aec56f321d9e2127c843b74f20dc2
0fa7c4c add match case folding tests WolframAlph Feb 14, 2025 https://github.com/python/cpython/pull/129550/commits/0fa7c4cb92aedb8dfa2900d36445932c7cbaa26f
27b1a09 add peepholer tests WolframAlph Feb 15, 2025 https://github.com/python/cpython/pull/129550/commits/27b1a09ac732a220f48385010a6d6f2259a00fe4
d3df8c8 polish ast code WolframAlph Feb 15, 2025 https://github.com/python/cpython/pull/129550/commits/d3df8c81468a537a5091e5041ca2292bf3d93dd6
e82841a add assertions WolframAlph Feb 15, 2025 https://github.com/python/cpython/pull/129550/commits/e82841ad94ab8beda581841a133a84ece560808a
cd6fbd7 use IS_NUMERIC_CONST_EXPR WolframAlph Feb 15, 2025 https://github.com/python/cpython/pull/129550/commits/cd6fbd7babb90f44837eb9e14673342d4248febb
300976e bring back tests WolframAlph Feb 15, 2025 https://github.com/python/cpython/pull/129550/commits/300976e704af9ea5f7a9316eaa72ef0a377e4561
3240d8e move unaryop to cfg WolframAlph Feb 15, 2025 https://github.com/python/cpython/pull/129550/commits/3240d8e584270f62c295f458488e9ef1d0b41602
74d2275 add tests WolframAlph Feb 15, 2025 https://github.com/python/cpython/pull/129550/commits/74d22758e1e66bd41f3bae8f1594be39c0391901
8358e28 cancel out unary not WolframAlph Feb 15, 2025 https://github.com/python/cpython/pull/129550/commits/8358e28a7469c52636b787c9b30d2ac77dd080eb
c1a1be5 fix optimize_if_const_unaryop WolframAlph Feb 15, 2025 https://github.com/python/cpython/pull/129550/commits/c1a1be5bfa4aa73658cbbe1854f90d3044133993
ef9221a add test_optimize_unary_not WolframAlph Feb 15, 2025 https://github.com/python/cpython/pull/129550/commits/ef9221a0dc58d13a3da20e559d82aa1b118ce9e7
598adce add optimize_unary_not_non_const WolframAlph Feb 16, 2025 https://github.com/python/cpython/pull/129550/commits/598adced181e1b5e195f0d998f4c0903e198ce13
bb60d4c add tests WolframAlph Feb 16, 2025 https://github.com/python/cpython/pull/129550/commits/bb60d4cf23d6ffc36ca7c672a5ed244e1daa9abc
eb99870 add tests WolframAlph Feb 16, 2025 https://github.com/python/cpython/pull/129550/commits/eb998702010734ec55a7517e4a1c5448120398bb
c93627e add static WolframAlph Feb 16, 2025 https://github.com/python/cpython/pull/129550/commits/c93627e556fb855269296b13fcdc1bab043c9592
f0f044a polish WolframAlph Feb 16, 2025 https://github.com/python/cpython/pull/129550/commits/f0f044a484e1342ccda7c68cd69c0f0fa8a768f9
a02ac66 add unaryop folding tests WolframAlph Feb 16, 2025 https://github.com/python/cpython/pull/129550/commits/a02ac6631262ad48ae9ba42962fdc8faa2cd7311
2739fa0 add not not test to catch misoptimized case WolframAlph Feb 17, 2025 https://github.com/python/cpython/pull/129550/commits/2739fa0414e4ffd5e76ce5b165bd6a15690d08a3
258a5b6 revert old unarynot handing, add contains/is + unarynot folding WolframAlph Feb 17, 2025 https://github.com/python/cpython/pull/129550/commits/258a5b6bc457c002f24d04cbf1c3f40733b5b092
59ee897 address reviews WolframAlph Feb 17, 2025 https://github.com/python/cpython/pull/129550/commits/59ee8972ce36d5c94b1e19572eab2754c50971a4
91ea2fa address reviews WolframAlph Feb 17, 2025 https://github.com/python/cpython/pull/129550/commits/91ea2fa6c3648299c29cd95cface9e2ff68f2bec
2c5ee86 simplify optimize_if_const_unaryop WolframAlph Feb 17, 2025 https://github.com/python/cpython/pull/129550/commits/2c5ee8619144bb6b5412238b65c7eb7bdbd95134
0399fce address reviews WolframAlph Feb 19, 2025 https://github.com/python/cpython/pull/129550/commits/0399fce74a855be4d71a9ab348fc653585cb3f6f
3c53923 simplify instr_make_load_const WolframAlph Feb 19, 2025 https://github.com/python/cpython/pull/129550/commits/3c5392318c067001932545943b15f4189c3b9d9e
a6a06c8 address review for tests WolframAlph Feb 20, 2025 https://github.com/python/cpython/pull/129550/commits/a6a06c80c4fabb8c31663b7a708555a38ad5fc40
2ea8425 replace macros WolframAlph Feb 20, 2025 https://github.com/python/cpython/pull/129550/commits/2ea8425bb5e14cf111599691c75a861d413d1f92
7c9c69b update peepholer test WolframAlph Feb 20, 2025 https://github.com/python/cpython/pull/129550/commits/7c9c69bd55a050619a69d00f73e0d51737844831
099afba define is_unarynegative_const_complex_expr & is_allowed_match_case_bi… WolframAlph Feb 20, 2025 https://github.com/python/cpython/pull/129550/commits/099afbab8fbb4728ee6d25309c182b51b1645538
0dad7c1 try to fold match case expression without checks WolframAlph Feb 20, 2025 https://github.com/python/cpython/pull/129550/commits/0dad7c17cb8c59c0100b9e864de2c4edb4744900
1e8b552 simplify folding WolframAlph Feb 20, 2025 https://github.com/python/cpython/pull/129550/commits/1e8b552a70480a9f05d33eb37bf7d7594b05fa12
f4e9a42 address review WolframAlph Feb 20, 2025 https://github.com/python/cpython/pull/129550/commits/f4e9a4277063c49242993e3d88e4aca23972eb0b
2dba23f minor adjustments WolframAlph Feb 21, 2025 https://github.com/python/cpython/pull/129550/commits/2dba23f6c843ef750f252745e2310517562607de
cafbc61 Merge branch 'main' into fold-binop-cfg iritkatriel Feb 21, 2025 https://github.com/python/cpython/pull/129550/commits/cafbc6159add708f4b820b62f4703dd50c606854
Clear filters https://github.com/python/cpython/pull/129550/files
Please reload this pagehttps://github.com/python/cpython/pull/129550/files
Please reload this pagehttps://github.com/python/cpython/pull/129550/files
test_ast.py https://github.com/python/cpython/pull/129550/files#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
utils.py https://github.com/python/cpython/pull/129550/files#diff-0d97c3127b43b032a328f3bb8c594848466651270de7c5dbfbbad98cc2150907
test_builtin.py https://github.com/python/cpython/pull/129550/files#diff-f23235c1f5dea0e2d79b33a58e00025ad3c440f96bb76013a1a37868e70a776b
test_peepholer.py https://github.com/python/cpython/pull/129550/files#diff-bcf92ed219340e9e0c52401909828c2e9a821541660073e24d64dd996beaf842
ast_opt.c https://github.com/python/cpython/pull/129550/files#diff-7a65e647c7985eb08fdefdab01ccdd2505c86ecdee2fa856fc9627c552ded146
flowgraph.c https://github.com/python/cpython/pull/129550/files#diff-3cbf15668c31488528b7ab0f903c674a0ecf550f4f53c1be6cf8cd965246c2a0
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L203
Lib/test/test_ast/test_ast.pyhttps://github.com/python/cpython/pull/129550/files#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
View file https://github.com/WolframAlph/cpython/blob/cafbc6159add708f4b820b62f4703dd50c606854/Lib/test/test_ast/test_ast.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/129550/{{ revealButtonHref }}
https://github.com/python/cpython/pull/129550/files#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
https://github.com/python/cpython/pull/129550/files#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
https://github.com/python/cpython/pull/129550/files#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
https://github.com/python/cpython/pull/129550/files#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
https://github.com/python/cpython/pull/129550/files#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
https://github.com/python/cpython/pull/129550/files#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
https://github.com/python/cpython/pull/129550/files#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
https://github.com/python/cpython/pull/129550/files#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
https://github.com/python/cpython/pull/129550/files#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
https://github.com/python/cpython/pull/129550/files#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
https://github.com/python/cpython/pull/129550/files#diff-a6d9c051aefcdf8f9606dd2ecc5a172a5716e2b38eff96097fc2b96528ed19d0
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L203
Lib/test/test_ast/utils.pyhttps://github.com/python/cpython/pull/129550/files#diff-0d97c3127b43b032a328f3bb8c594848466651270de7c5dbfbbad98cc2150907
View file https://github.com/WolframAlph/cpython/blob/cafbc6159add708f4b820b62f4703dd50c606854/Lib/test/test_ast/utils.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/129550/{{ revealButtonHref }}
https://github.com/python/cpython/pull/129550/files#diff-0d97c3127b43b032a328f3bb8c594848466651270de7c5dbfbbad98cc2150907
Lib/test/test_builtin.pyhttps://github.com/python/cpython/pull/129550/files#diff-f23235c1f5dea0e2d79b33a58e00025ad3c440f96bb76013a1a37868e70a776b
View file https://github.com/WolframAlph/cpython/blob/cafbc6159add708f4b820b62f4703dd50c606854/Lib/test/test_builtin.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/129550/{{ revealButtonHref }}
https://github.com/python/cpython/pull/129550/files#diff-f23235c1f5dea0e2d79b33a58e00025ad3c440f96bb76013a1a37868e70a776b
https://github.com/python/cpython/pull/129550/files#diff-f23235c1f5dea0e2d79b33a58e00025ad3c440f96bb76013a1a37868e70a776b
https://github.com/python/cpython/pull/129550/files#diff-f23235c1f5dea0e2d79b33a58e00025ad3c440f96bb76013a1a37868e70a776b
Please reload this pagehttps://github.com/python/cpython/pull/129550/files
Please reload this pagehttps://github.com/python/cpython/pull/129550/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.