| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:42149399-305a-3bcb-8ec2-397019d05809 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 92DA:1DB9:6B9373:93958D:6992EFF2 |
| html-safe-nonce | 8e12d2a94b9f4eff7ef31d02ce9d7c6be3dcecf1134c9ac9c0ad794c71d8cdd9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MkRBOjFEQjk6NkI5MzczOjkzOTU4RDo2OTkyRUZGMiIsInZpc2l0b3JfaWQiOiI1MTAxNzc3NTU3MTU5ODY2MzU0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d8271b372f773ab57e0238bedd9e02a3e4832eccd9187f719da05b453c76610f |
| hovercard-subject-tag | pull_request:2310834490 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | ///pull_requests/show/files |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/129550/files |
| twitter:image | https://avatars.githubusercontent.com/u/46005801?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/46005801?s=400&v=4 |
| og:image:alt | 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 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 01ab16879a3159e6f0717ab948b9b562e162a6aafd1f4393b786b07b747df244 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b1570f3928bef80fa5fc7890ce0942e9b696ad9d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| Skip to content | https://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 AI | https://github.com/features/copilot |
| GitHub SparkBuild and deploy intelligent apps | https://github.com/features/spark |
| GitHub ModelsManage and compare prompts | https://github.com/features/models |
| MCP RegistryNewIntegrate external tools | https://github.com/mcp |
| ActionsAutomate any workflow | https://github.com/features/actions |
| CodespacesInstant dev environments | https://github.com/features/codespaces |
| IssuesPlan and track work | https://github.com/features/issues |
| Code ReviewManage code changes | https://github.com/features/code-review |
| GitHub Advanced SecurityFind and fix vulnerabilities | https://github.com/security/advanced-security |
| Code securitySecure your code as you build | https://github.com/security/advanced-security/code-security |
| Secret protectionStop leaks before they start | https://github.com/security/advanced-security/secret-protection |
| Why GitHub | https://github.com/why-github |
| Documentation | https://docs.github.com |
| Blog | https://github.blog |
| Changelog | https://github.blog/changelog |
| Marketplace | https://github.com/marketplace |
| View all features | https://github.com/features |
| Enterprises | https://github.com/enterprise |
| Small and medium teams | https://github.com/team |
| Startups | https://github.com/enterprise/startups |
| Nonprofits | https://github.com/solutions/industry/nonprofits |
| App Modernization | https://github.com/solutions/use-case/app-modernization |
| DevSecOps | https://github.com/solutions/use-case/devsecops |
| DevOps | https://github.com/solutions/use-case/devops |
| CI/CD | https://github.com/solutions/use-case/ci-cd |
| View all use cases | https://github.com/solutions/use-case |
| Healthcare | https://github.com/solutions/industry/healthcare |
| Financial services | https://github.com/solutions/industry/financial-services |
| Manufacturing | https://github.com/solutions/industry/manufacturing |
| Government | https://github.com/solutions/industry/government |
| View all industries | https://github.com/solutions/industry |
| View all solutions | https://github.com/solutions |
| AI | https://github.com/resources/articles?topic=ai |
| Software Development | https://github.com/resources/articles?topic=software-development |
| DevOps | https://github.com/resources/articles?topic=devops |
| Security | https://github.com/resources/articles?topic=security |
| View all topics | https://github.com/resources/articles |
| Customer stories | https://github.com/customer-stories |
| Events & webinars | https://github.com/resources/events |
| Ebooks & reports | https://github.com/resources/whitepapers |
| Business insights | https://github.com/solutions/executive-insights |
| GitHub Skills | https://skills.github.com |
| Documentation | https://docs.github.com |
| Customer support | https://support.github.com |
| Community forum | https://github.com/orgs/community/discussions |
| Trust center | https://github.com/trust-center |
| Partners | https://github.com/partners |
| GitHub SponsorsFund open source developers | https://github.com/sponsors |
| Security Lab | https://securitylab.github.com |
| Maintainer Community | https://maintainers.github.com |
| Accelerator | https://github.com/accelerator |
| Archive Program | https://archiveprogram.github.com |
| Topics | https://github.com/topics |
| Trending | https://github.com/trending |
| Collections | https://github.com/collections |
| Enterprise platformAI-powered developer platform | https://github.com/enterprise |
| GitHub Advanced SecurityEnterprise-grade security features | https://github.com/security/advanced-security |
| Copilot for BusinessEnterprise-grade AI features | https://github.com/features/copilot/copilot-business |
| Premium SupportEnterprise-grade 24/7 support | https://github.com/premium-support |
| Pricing | https://github.com/pricing |
| Search syntax tips | https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax |
| documentation | https://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 |
| Reload | https://github.com/python/cpython/pull/129550/files |
| Reload | https://github.com/python/cpython/pull/129550/files |
| Reload | https://github.com/python/cpython/pull/129550/files |
|
python
| https://github.com/python |
| cpython | https://github.com/python/cpython |
| Please reload this page | https://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 service | https://docs.github.com/terms |
| privacy statement | https://docs.github.com/privacy |
| Sign in | https://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose |
| iritkatriel | https://github.com/iritkatriel |
| python:main | https://github.com/python/cpython/tree/main |
| WolframAlph:fold-binop-cfg | https://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 page | https://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 page | https://github.com/python/cpython/pull/129550/files |
| Please reload this page | https://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.py | https://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.py | https://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.py | https://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 page | https://github.com/python/cpython/pull/129550/files |
| Please reload this page | https://github.com/python/cpython/pull/129550/files |
|
| https://github.com |
| Terms | https://docs.github.com/site-policy/github-terms/github-terms-of-service |
| Privacy | https://docs.github.com/site-policy/privacy-policies/github-privacy-statement |
| Security | https://github.com/security |
| Status | https://www.githubstatus.com/ |
| Community | https://github.community/ |
| Docs | https://docs.github.com/ |
| Contact | https://support.github.com?tags=dotcom-footer |