René's URL Explorer Experiment


Title: gh-104240: make _PyCompile_CodeGen support different compilation modes by iritkatriel · Pull Request #104241 · python/cpython · GitHub

Open Graph Title: gh-104240: make _PyCompile_CodeGen support different compilation modes by iritkatriel · Pull Request #104241 · python/cpython

X Title: gh-104240: make _PyCompile_CodeGen support different compilation modes by iritkatriel · Pull Request #104241 · python/cpython

Description: With this PR we can do this: from _testinternalcapi import compiler_codegen, optimize_cfg, assemble_code_object import ast import opcode import textwrap import types a = ast.parse("(x+y)/2", mode='eval') filename = "myfile.py" eval_mode = 1 # 0=exec, 1=eval, 2=single insts = compiler_codegen(a, filename, 0, eval_mode) consts = list(range(5)) insts = optimize_cfg(insts, consts) metadata = { 'name' : 'avg', 'qualname' : 'stats.avg', 'consts' : [2], 'argcount' : 0, 'names' : {'x' : 0, 'y' : 1}, 'varnames' : {}, } from test.test_compiler_assemble import IsolatedAssembleTests IsolatedAssembleTests().complete_metadata(metadata) co = assemble_code_object(filename, insts, metadata) for x,y in [(3, 4), (-100, 200), (10, 18)]: f = types.FunctionType(co, {'x': x, 'y': y}) print(f'avg of {x} and {y} is {f()}') Issue: gh-104240

Open Graph Description: With this PR we can do this: from _testinternalcapi import compiler_codegen, optimize_cfg, assemble_code_object import ast import opcode import textwrap import types a = ast.parse("(x+y)/2&qu...

X Description: With this PR we can do this: from _testinternalcapi import compiler_codegen, optimize_cfg, assemble_code_object import ast import opcode import textwrap import types a = ast.parse("(x+y)/...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:ddeb89ec-181f-27f5-8561-38c25effb517
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE478:9D4F4:85E62C:B6C3FD:6969DDEA
html-safe-nonce34418248d46e9726714bc3a502dcf3f5a89b14438dec821705a5429f9ab83a1c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDc4OjlENEY0Ojg1RTYyQzpCNkMzRkQ6Njk2OURERUEiLCJ2aXNpdG9yX2lkIjoiNzE0NjU0ODg4NzYzNDQzNTU2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac6d39b4e321e7b3044e3f7911a503016f967f53c3e3e005190798c0aec89dd93f
hovercard-subject-tagpull_request:1340831061
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/104241/files
twitter:imagehttps://avatars.githubusercontent.com/u/1055913?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1055913?s=400&v=4
og:image:altWith this PR we can do this: from _testinternalcapi import compiler_codegen, optimize_cfg, assemble_code_object import ast import opcode import textwrap import types a = ast.parse("(x+y)/2&qu...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8
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
releasebdde15ad1b403e23b08bbd89b53fbe6bdf688cad
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/104241/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F104241%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%2F104241%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/104241/files
Reloadhttps://github.com/python/cpython/pull/104241/files
Reloadhttps://github.com/python/cpython/pull/104241/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/104241/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/104241/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
iritkatrielhttps://github.com/iritkatriel
python:mainhttps://github.com/python/cpython/tree/main
iritkatriel:compilation_pipelinehttps://github.com/iritkatriel/cpython/tree/compilation_pipeline
Conversation 9 https://github.com/python/cpython/pull/104241
Commits 4 https://github.com/python/cpython/pull/104241/commits
Checks 0 https://github.com/python/cpython/pull/104241/checks
Files changed https://github.com/python/cpython/pull/104241/files
Please reload this pagehttps://github.com/python/cpython/pull/104241/files
gh-104240: make _PyCompile_CodeGen support different compilation modes https://github.com/python/cpython/pull/104241/files#top
Show all changes 4 commits https://github.com/python/cpython/pull/104241/files
0630b4e move compiler_enter_scope out of compiler_codegen iritkatriel May 6, 2023 https://github.com/python/cpython/pull/104241/commits/0630b4ebae3b81eec4484b6bc22ea7756cedd8c2
52f3a59 support different compilation modes in _PyCompile_CodeGen iritkatriel May 6, 2023 https://github.com/python/cpython/pull/104241/commits/52f3a59a3f273d8c44cd621479b4e09d6ef45b8a
7f654d7 update codegen test (we add return None now) iritkatriel May 6, 2023 https://github.com/python/cpython/pull/104241/commits/7f654d7f22bc3b60d89f74ca4996884152d29f73
de8b2ba Revert "move compiler_enter_scope out of compiler_codegen" iritkatriel May 7, 2023 https://github.com/python/cpython/pull/104241/commits/de8b2bac5e80cad9fd02e7c1123673787a6484bc
Clear filters https://github.com/python/cpython/pull/104241/files
Please reload this pagehttps://github.com/python/cpython/pull/104241/files
Please reload this pagehttps://github.com/python/cpython/pull/104241/files
pycore_compile.h https://github.com/python/cpython/pull/104241/files#diff-3dae19a721cfc66db8ff0589c0b4a4c6947fa714e3d3a0d86a5ae96f5c98b6fb
pycore_global_objects_fini_generated.h https://github.com/python/cpython/pull/104241/files#diff-31f682b2a04cda997f449a9816ee5fae305e3bfa7357afcb794615921c6a88d2
pycore_global_strings.h https://github.com/python/cpython/pull/104241/files#diff-7656e411eccd63ff8aab3e11de3f45035665f6b639206d3f440727dfb5e0ebcf
pycore_runtime_init_generated.h https://github.com/python/cpython/pull/104241/files#diff-69a1fc720f0b1e9005cf7717dd81c823399da81dd2f6480664b51238c1ef93f0
pycore_unicodeobject_generated.h https://github.com/python/cpython/pull/104241/files#diff-510f6084b63d39305481b719ae0a29475ba759e259a8e4cee4f07c451ffbb2d6
test_compiler_codegen.py https://github.com/python/cpython/pull/104241/files#diff-9987be07783ee714c99f2e5097be8290413c27fe4e5249cafbf408194f74df6a
_testinternalcapi.c https://github.com/python/cpython/pull/104241/files#diff-687f4a736f1f6ad4b6cd4ff65c8e0113408304e8d65530dbd41b3f59a081a126
_testinternalcapi.c.h https://github.com/python/cpython/pull/104241/files#diff-096dae2f762b84a274d30b1186fb60a75723b3dd35b7668dce93158cfe6e9444
compile.c https://github.com/python/cpython/pull/104241/files#diff-ebc983d9f91e5bcf73500e377ac65e85863c4f77fd5b6b6caf4fcdf7c0f0b057
Include/internal/pycore_compile.hhttps://github.com/python/cpython/pull/104241/files#diff-3dae19a721cfc66db8ff0589c0b4a4c6947fa714e3d3a0d86a5ae96f5c98b6fb
View file https://github.com/iritkatriel/cpython/blob/de8b2bac5e80cad9fd02e7c1123673787a6484bc/Include/internal/pycore_compile.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/104241/{{ revealButtonHref }}
https://github.com/python/cpython/pull/104241/files#diff-3dae19a721cfc66db8ff0589c0b4a4c6947fa714e3d3a0d86a5ae96f5c98b6fb
https://github.com/python/cpython/pull/104241/files#diff-3dae19a721cfc66db8ff0589c0b4a4c6947fa714e3d3a0d86a5ae96f5c98b6fb
Include/internal/pycore_global_objects_fini_generated.hhttps://github.com/python/cpython/pull/104241/files#diff-31f682b2a04cda997f449a9816ee5fae305e3bfa7357afcb794615921c6a88d2
View file https://github.com/iritkatriel/cpython/blob/de8b2bac5e80cad9fd02e7c1123673787a6484bc/Include/internal/pycore_global_objects_fini_generated.h
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/104241/files
Include/internal/pycore_global_strings.hhttps://github.com/python/cpython/pull/104241/files#diff-7656e411eccd63ff8aab3e11de3f45035665f6b639206d3f440727dfb5e0ebcf
View file https://github.com/iritkatriel/cpython/blob/de8b2bac5e80cad9fd02e7c1123673787a6484bc/Include/internal/pycore_global_strings.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/104241/{{ revealButtonHref }}
https://github.com/python/cpython/pull/104241/files#diff-7656e411eccd63ff8aab3e11de3f45035665f6b639206d3f440727dfb5e0ebcf
https://github.com/python/cpython/pull/104241/files#diff-7656e411eccd63ff8aab3e11de3f45035665f6b639206d3f440727dfb5e0ebcf
Include/internal/pycore_runtime_init_generated.hhttps://github.com/python/cpython/pull/104241/files#diff-69a1fc720f0b1e9005cf7717dd81c823399da81dd2f6480664b51238c1ef93f0
View file https://github.com/iritkatriel/cpython/blob/de8b2bac5e80cad9fd02e7c1123673787a6484bc/Include/internal/pycore_runtime_init_generated.h
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/104241/files
Include/internal/pycore_unicodeobject_generated.hhttps://github.com/python/cpython/pull/104241/files#diff-510f6084b63d39305481b719ae0a29475ba759e259a8e4cee4f07c451ffbb2d6
View file https://github.com/iritkatriel/cpython/blob/de8b2bac5e80cad9fd02e7c1123673787a6484bc/Include/internal/pycore_unicodeobject_generated.h
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/104241/files
Lib/test/test_compiler_codegen.pyhttps://github.com/python/cpython/pull/104241/files#diff-9987be07783ee714c99f2e5097be8290413c27fe4e5249cafbf408194f74df6a
View file https://github.com/iritkatriel/cpython/blob/de8b2bac5e80cad9fd02e7c1123673787a6484bc/Lib/test/test_compiler_codegen.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/104241/{{ revealButtonHref }}
https://github.com/python/cpython/pull/104241/files#diff-9987be07783ee714c99f2e5097be8290413c27fe4e5249cafbf408194f74df6a
https://github.com/python/cpython/pull/104241/files#diff-9987be07783ee714c99f2e5097be8290413c27fe4e5249cafbf408194f74df6a
Modules/_testinternalcapi.chttps://github.com/python/cpython/pull/104241/files#diff-687f4a736f1f6ad4b6cd4ff65c8e0113408304e8d65530dbd41b3f59a081a126
View file https://github.com/iritkatriel/cpython/blob/de8b2bac5e80cad9fd02e7c1123673787a6484bc/Modules/_testinternalcapi.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/104241/{{ revealButtonHref }}
https://github.com/python/cpython/pull/104241/files#diff-687f4a736f1f6ad4b6cd4ff65c8e0113408304e8d65530dbd41b3f59a081a126
https://github.com/python/cpython/pull/104241/files#diff-687f4a736f1f6ad4b6cd4ff65c8e0113408304e8d65530dbd41b3f59a081a126
Modules/clinic/_testinternalcapi.c.hhttps://github.com/python/cpython/pull/104241/files#diff-096dae2f762b84a274d30b1186fb60a75723b3dd35b7668dce93158cfe6e9444
View file https://github.com/iritkatriel/cpython/blob/de8b2bac5e80cad9fd02e7c1123673787a6484bc/Modules/clinic/_testinternalcapi.c.h
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/104241/files
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L228
Python/compile.chttps://github.com/python/cpython/pull/104241/files#diff-ebc983d9f91e5bcf73500e377ac65e85863c4f77fd5b6b6caf4fcdf7c0f0b057
View file https://github.com/iritkatriel/cpython/blob/de8b2bac5e80cad9fd02e7c1123673787a6484bc/Python/compile.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/104241/{{ revealButtonHref }}
https://github.com/python/cpython/pull/104241/files#diff-ebc983d9f91e5bcf73500e377ac65e85863c4f77fd5b6b6caf4fcdf7c0f0b057
https://github.com/python/cpython/pull/104241/files#diff-ebc983d9f91e5bcf73500e377ac65e85863c4f77fd5b6b6caf4fcdf7c0f0b057
https://github.com/python/cpython/pull/104241/files#diff-ebc983d9f91e5bcf73500e377ac65e85863c4f77fd5b6b6caf4fcdf7c0f0b057
https://github.com/python/cpython/pull/104241/files#diff-ebc983d9f91e5bcf73500e377ac65e85863c4f77fd5b6b6caf4fcdf7c0f0b057
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.