René's URL Explorer Experiment


Title: gh-98831: Support conditional effects; use for LOAD_ATTR by gvanrossum · Pull Request #101333 · python/cpython · GitHub

Open Graph Title: gh-98831: Support conditional effects; use for LOAD_ATTR by gvanrossum · Pull Request #101333 · python/cpython

X Title: gh-98831: Support conditional effects; use for LOAD_ATTR by gvanrossum · Pull Request #101333 · python/cpython

Description: We can now write inst(OP, (foo if (oparg & 1) -- bar if (oparg & 2)) { ... } which pops foo off the stack if oparg & 1, otherwise setting it to NULL, and pushes bar onto the stack if oparg & 2 (otherwise ignoring it). This syntax cannot be combined with an array size on the same effect, but it can be combined with a type (untested). In addition, it is incompatible with an array size closer to the stack top, e.g. foo if (oparg&1), bar[oparg>>1] is not supported (I don't think it's used, and generating code for it would be slightly awkward, but could be done if needed). The implementation switches to using POP() and PUSH() (from PEEK() and POKE()) for those variables that are either conditional or whose position relative to the bottom (!) of the stack depends on a condition. (See the added test for details.) To demonstrate this, I converted LOAD_ATTR (but not its specializations). Issue: gh-98831

Open Graph Description: We can now write inst(OP, (foo if (oparg & 1) -- bar if (oparg & 2)) { ... } which pops foo off the stack if oparg & 1, otherwise setting it to NULL, and pushes bar onto the stack ...

X Description: We can now write inst(OP, (foo if (oparg & 1) -- bar if (oparg & 2)) { ... } which pops foo off the stack if oparg & 1, otherwise setting it to NULL, and pushes bar ont...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:0af8f505-6a3d-1d53-84f8-785b0034e728
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC5D2:333370:1D14A31:289CA16:696A5C02
html-safe-nonce057c12b4445482791d397f4e37f6de9028028f76d0dbeb97b45442454907c132
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNUQyOjMzMzM3MDoxRDE0QTMxOjI4OUNBMTY6Njk2QTVDMDIiLCJ2aXNpdG9yX2lkIjoiODEwMzIyNTI5MjAxMzMyOTQxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace003cb7de411e40bb1e157a4068f036efe1859f49efe4f30eea26bdef41dd9bd
hovercard-subject-tagpull_request:1217290621
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/101333/files
twitter:imagehttps://avatars.githubusercontent.com/u/2894642?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/2894642?s=400&v=4
og:image:altWe can now write inst(OP, (foo if (oparg & 1) -- bar if (oparg & 2)) { ... } which pops foo off the stack if oparg & 1, otherwise setting it to NULL, and pushes bar onto the stack ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None3f871c8e07f0ae1886fa8dac284166d28b09ad5bada6476fc10b674e489788ef
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
release63c426b30d262aba269ef14c40e3c817b384cd61
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/101333/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F101333%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%2F101333%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/101333/files
Reloadhttps://github.com/python/cpython/pull/101333/files
Reloadhttps://github.com/python/cpython/pull/101333/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/101333/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/101333/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
gvanrossumhttps://github.com/gvanrossum
python:mainhttps://github.com/python/cpython/tree/main
gvanrossum:cond-caseshttps://github.com/gvanrossum/cpython/tree/cond-cases
Conversation 28 https://github.com/python/cpython/pull/101333
Commits 15 https://github.com/python/cpython/pull/101333/commits
Checks 0 https://github.com/python/cpython/pull/101333/checks
Files changed https://github.com/python/cpython/pull/101333/files
Please reload this pagehttps://github.com/python/cpython/pull/101333/files
gh-98831: Support conditional effects; use for LOAD_ATTR https://github.com/python/cpython/pull/101333/files#top
Show all changes 15 commits https://github.com/python/cpython/pull/101333/files
af97a7e Add parser support for conditional stack effects gvanrossum Jan 25, 2023 https://github.com/python/cpython/pull/101333/commits/af97a7e20004c2de27eeeacd7f1a368940156deb
fbcdde3 Fix a typo in test_generator.py that made it into main :-( gvanrossum Jan 25, 2023 https://github.com/python/cpython/pull/101333/commits/fbcdde371e1636927b542aabd1293b7e071d1dc6
27246e9 Make conditional effects work, in theory gvanrossum Jan 25, 2023 https://github.com/python/cpython/pull/101333/commits/27246e9d2b2c10d7e72677ca6c7ffd83cd4136a7
667630e Convert LOAD_ATTR to new format gvanrossum Jan 26, 2023 https://github.com/python/cpython/pull/101333/commits/667630e6ca0dc6aef7719b82079a1d11d1642801
69dbc5e Conditionalize effect_size() gvanrossum Jan 26, 2023 https://github.com/python/cpython/pull/101333/commits/69dbc5e87f8edb9375b500140fdef749dcf779f4
6a03438 Fix two bugs in case generator gvanrossum Jan 26, 2023 https://github.com/python/cpython/pull/101333/commits/6a03438b861071e327d558862123c640d6745208
2310916 Merge branch 'fix-op-metadata' into cond-cases gvanrossum Jan 26, 2023 https://github.com/python/cpython/pull/101333/commits/23109165c792391bb96fec127b90c9dd832e8bc4
a0fa513 Blackify gvanrossum Jan 26, 2023 https://github.com/python/cpython/pull/101333/commits/a0fa513d384add21868a54cbc8335b7a3996f28c
8aeaf01 Merge remote-tracking branch 'origin/main' into cond-cases gvanrossum Jan 26, 2023 https://github.com/python/cpython/pull/101333/commits/8aeaf0169959afe459b335ff655f8a36ca0fe675
6240934 Use Irit's idea gvanrossum Jan 26, 2023 https://github.com/python/cpython/pull/101333/commits/62409346ce4edef34ee63b2591c42e1a3a627284
d78e2a7 Cleanup gvanrossum Jan 26, 2023 https://github.com/python/cpython/pull/101333/commits/d78e2a74a7f2c51c3bd93e8728c4fd550a596605
e69c1f3 Change order in LOAD_ATTR output effect gvanrossum Jan 27, 2023 https://github.com/python/cpython/pull/101333/commits/e69c1f3e7a01d253e05bd01ce0b57dce9b96cfeb
c5529c6 Fix type annotations to satisfy pyright (and mypy mostly) gvanrossum Jan 28, 2023 https://github.com/python/cpython/pull/101333/commits/c5529c66c080781f9003de6b312ed3ef2d663500
37e3b40 Solve uninitalized variable warning using = NULL gvanrossum Jan 28, 2023 https://github.com/python/cpython/pull/101333/commits/37e3b407f26160c20cbbd85fd55489ce237b8946
81e5236 Use 'X ? 1 : 0' instead of 'X != 0' gvanrossum Jan 28, 2023 https://github.com/python/cpython/pull/101333/commits/81e523659245b8fb421aa755ac87abc44fa4ed98
Clear filters https://github.com/python/cpython/pull/101333/files
Please reload this pagehttps://github.com/python/cpython/pull/101333/files
Please reload this pagehttps://github.com/python/cpython/pull/101333/files
bytecodes.c https://github.com/python/cpython/pull/101333/files#diff-729a985b0cb8b431cb291f1edb561bbbfea22e3f8c262451cd83328a0936a342
generated_cases.c.h https://github.com/python/cpython/pull/101333/files#diff-4ef46fa654f95502e49a24f7dc8ee31a4cac9b3433fe9cd2b2d4dd78cfbad448
opcode_metadata.h https://github.com/python/cpython/pull/101333/files#diff-f862bc60824529a25ba378be850ecc6762f03c6c944266d30ac7172d10132498
generate_cases.py https://github.com/python/cpython/pull/101333/files#diff-65feee563fa44b472b07751184c6f557699f84b3c2ef79174bfd5d538d748272
parser.py https://github.com/python/cpython/pull/101333/files#diff-bc6851ce97efb76ebfd0bc2f37d62ac0902080d0749be72d29d978f0ee2fa0e4
test_generator.py https://github.com/python/cpython/pull/101333/files#diff-fc6342d3ebecd67de2e51a64957243cedfb00bc645307fe91e8e8b285ecca98c
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L221
Python/bytecodes.chttps://github.com/python/cpython/pull/101333/files#diff-729a985b0cb8b431cb291f1edb561bbbfea22e3f8c262451cd83328a0936a342
View file https://github.com/gvanrossum/cpython/blob/81e523659245b8fb421aa755ac87abc44fa4ed98/Python/bytecodes.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/101333/{{ revealButtonHref }}
https://github.com/python/cpython/pull/101333/files#diff-729a985b0cb8b431cb291f1edb561bbbfea22e3f8c262451cd83328a0936a342
gvanrossumhttps://github.com/gvanrossum
Jan 28, 2023https://github.com/python/cpython/pull/101333/files#r1089827515
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/101333/files
https://github.com/python/cpython/pull/101333/files#diff-729a985b0cb8b431cb291f1edb561bbbfea22e3f8c262451cd83328a0936a342
https://github.com/python/cpython/pull/101333/files#diff-729a985b0cb8b431cb291f1edb561bbbfea22e3f8c262451cd83328a0936a342
https://github.com/python/cpython/pull/101333/files#diff-729a985b0cb8b431cb291f1edb561bbbfea22e3f8c262451cd83328a0936a342
https://github.com/python/cpython/pull/101333/files#diff-729a985b0cb8b431cb291f1edb561bbbfea22e3f8c262451cd83328a0936a342
https://github.com/python/cpython/pull/101333/files#diff-729a985b0cb8b431cb291f1edb561bbbfea22e3f8c262451cd83328a0936a342
Python/generated_cases.c.hhttps://github.com/python/cpython/pull/101333/files#diff-4ef46fa654f95502e49a24f7dc8ee31a4cac9b3433fe9cd2b2d4dd78cfbad448
View file https://github.com/gvanrossum/cpython/blob/81e523659245b8fb421aa755ac87abc44fa4ed98/Python/generated_cases.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/101333/files
Python/opcode_metadata.hhttps://github.com/python/cpython/pull/101333/files#diff-f862bc60824529a25ba378be850ecc6762f03c6c944266d30ac7172d10132498
View file https://github.com/gvanrossum/cpython/blob/81e523659245b8fb421aa755ac87abc44fa4ed98/Python/opcode_metadata.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/101333/{{ revealButtonHref }}
https://github.com/python/cpython/pull/101333/files#diff-f862bc60824529a25ba378be850ecc6762f03c6c944266d30ac7172d10132498
https://github.com/python/cpython/pull/101333/files#diff-f862bc60824529a25ba378be850ecc6762f03c6c944266d30ac7172d10132498
https://github.com/python/cpython/pull/101333/files#diff-f862bc60824529a25ba378be850ecc6762f03c6c944266d30ac7172d10132498
https://github.com/python/cpython/pull/101333/files#diff-f862bc60824529a25ba378be850ecc6762f03c6c944266d30ac7172d10132498
https://github.com/python/cpython/pull/101333/files#diff-f862bc60824529a25ba378be850ecc6762f03c6c944266d30ac7172d10132498
https://github.com/python/cpython/pull/101333/files#diff-f862bc60824529a25ba378be850ecc6762f03c6c944266d30ac7172d10132498
https://github.com/python/cpython/pull/101333/files#diff-f862bc60824529a25ba378be850ecc6762f03c6c944266d30ac7172d10132498
https://github.com/python/cpython/pull/101333/files#diff-f862bc60824529a25ba378be850ecc6762f03c6c944266d30ac7172d10132498
Please reload this pagehttps://github.com/python/cpython/pull/101333/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.