René's URL Explorer Experiment


Title: GH-106008: Make implicit boolean conversions explicit by brandtbucher · Pull Request #106003 · python/cpython · GitHub

Open Graph Title: GH-106008: Make implicit boolean conversions explicit by brandtbucher · Pull Request #106003 · python/cpython

X Title: GH-106008: Make implicit boolean conversions explicit by brandtbucher · Pull Request #106003 · python/cpython

Description: ...and specialize them! This adds a new TO_BOOL bytecode that prefixes all UNARY_NOT, POP_JUMP_IF_TRUE, and POP_JUMP_IF_FALSE instructions, which now require an exact boolean. We also use a spare bit in COMPARE_OP's oparg to indicate whether the result should be converted to bool (this saves a TO_BOOL for most branches, and is a no-op for all COMPARE_OP specializations). "0% faster". Stats show a 93.5% hit rate for the new instructions. 📚 Documentation preview 📚: https://cpython-previews--106003.org.readthedocs.build/ Issue: gh-106008

Open Graph Description: ...and specialize them! This adds a new TO_BOOL bytecode that prefixes all UNARY_NOT, POP_JUMP_IF_TRUE, and POP_JUMP_IF_FALSE instructions, which now require an exact boolean. We also use a spare b...

X Description: ...and specialize them! This adds a new TO_BOOL bytecode that prefixes all UNARY_NOT, POP_JUMP_IF_TRUE, and POP_JUMP_IF_FALSE instructions, which now require an exact boolean. We also use a spare b...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:de44261c-8dad-1d01-9c16-f76425bd4c0b
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE826:21FEDA:1C4FFF1:26F23AC:696ABA5A
html-safe-nonce727383cefa668e8a1c27e947a07ae124070978f796676c4d985920b8176a7790
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODI2OjIxRkVEQToxQzRGRkYxOjI2RjIzQUM6Njk2QUJBNUEiLCJ2aXNpdG9yX2lkIjoiNjcxOTEzODIxMDc2NTI1NzMwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac78b63f35e76ceedcdeb674ebd6a31777a1bf69fe4e17b9d70998cd04865e8014
hovercard-subject-tagpull_request:1404313169
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/106003/files
twitter:imagehttps://avatars.githubusercontent.com/u/40968415?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40968415?s=400&v=4
og:image:alt...and specialize them! This adds a new TO_BOOL bytecode that prefixes all UNARY_NOT, POP_JUMP_IF_TRUE, and POP_JUMP_IF_FALSE instructions, which now require an exact boolean. We also use a spare b...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None46ce962e0e18113ea447391b6ace8b02d4d2861e57b4fbab3658698f73d8855b
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
release30300f30bb3949de255e84a146706a3bdb5c19c9
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/106003/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F106003%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%2F106003%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/106003/files
Reloadhttps://github.com/python/cpython/pull/106003/files
Reloadhttps://github.com/python/cpython/pull/106003/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/106003/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/106003/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
brandtbucherhttps://github.com/brandtbucher
python:mainhttps://github.com/python/cpython/tree/main
brandtbucher:to-boolhttps://github.com/brandtbucher/cpython/tree/to-bool
Conversation 16 https://github.com/python/cpython/pull/106003
Commits 18 https://github.com/python/cpython/pull/106003/commits
Checks 0 https://github.com/python/cpython/pull/106003/checks
Files changed https://github.com/python/cpython/pull/106003/files
Please reload this pagehttps://github.com/python/cpython/pull/106003/files
GH-106008: Make implicit boolean conversions explicit https://github.com/python/cpython/pull/106003/files#top
Show all changes 18 commits https://github.com/python/cpython/pull/106003/files
69781b4 Make boolean conversions in branches explicit brandtbucher Jun 6, 2023 https://github.com/python/cpython/pull/106003/commits/69781b4244a9485837b5eda473533e5c280068c0
5289c7f Specialize UNARY_NOT brandtbucher Jun 6, 2023 https://github.com/python/cpython/pull/106003/commits/5289c7f69e7e2ba75cafa076da55dd9f179cae7c
7e5c9df Remove unused stats brandtbucher Jun 7, 2023 https://github.com/python/cpython/pull/106003/commits/7e5c9df329695174378971dfe106e73ad368455a
27bb264 Make UNARY_NOT_BOOL a little bit slicker brandtbucher Jun 7, 2023 https://github.com/python/cpython/pull/106003/commits/27bb264e8247af28f554ea620389191fb7e78bbe
0463633 Replace UNARY_NOT with TO_BOOL brandtbucher Jun 9, 2023 https://github.com/python/cpython/pull/106003/commits/0463633b0f9583ad7aa322af4e9c0228949eed20
d2932a1 Catch up with main brandtbucher Jun 21, 2023 https://github.com/python/cpython/pull/106003/commits/d2932a1104df74a415b06fbcd85e9dc58f9413f7
47ec38f Branchless branching brandtbucher Jun 21, 2023 https://github.com/python/cpython/pull/106003/commits/47ec38f00f9a153473b19013cf71261550bbbe6a
a0bd53a Add a "boolean conversion" bit to COMPARE_OP brandtbucher Jun 21, 2023 https://github.com/python/cpython/pull/106003/commits/a0bd53a31edc9594e561b076b9bb23f3ae0be949
bab539b More stats for heap types brandtbucher Jun 21, 2023 https://github.com/python/cpython/pull/106003/commits/bab539bf50f769912c96f51ae427d4bac122e5d4
757b1cc Specialize TO_BOOL_ALWAYS_TRUE brandtbucher Jun 21, 2023 https://github.com/python/cpython/pull/106003/commits/757b1ccf830e46f7ee68e7e2e2c12869d81fc81c
f9fa498 Fix refleak and error handling brandtbucher Jun 21, 2023 https://github.com/python/cpython/pull/106003/commits/f9fa498686bbcb7e1b98a1e2769c5b1d37f26e9a
0c14344 Catch up with main brandtbucher Jun 22, 2023 https://github.com/python/cpython/pull/106003/commits/0c14344e7e746dae65e09061fcb52051dcd1c9bd
d314078 Cleanup brandtbucher Jun 23, 2023 https://github.com/python/cpython/pull/106003/commits/d31407825cac7b01443449db0636e6b1af6dbb5d
9aa83b5 blurb add brandtbucher Jun 23, 2023 https://github.com/python/cpython/pull/106003/commits/9aa83b5ef2259f12203218710a1b9085e980f3b4
a76f11d Docs brandtbucher Jun 23, 2023 https://github.com/python/cpython/pull/106003/commits/a76f11dcceb1ba9d28e72d21f2a8eccf0fc16507
c2d4a33 Clean up some commnts brandtbucher Jun 23, 2023 https://github.com/python/cpython/pull/106003/commits/c2d4a33f51c200f3c70c3b4f84fd808ecd122b3b
7638b76 Add cast brandtbucher Jun 29, 2023 https://github.com/python/cpython/pull/106003/commits/7638b76e18d78fab6c5d91a997ad8e4f2d97d40d
6b4a598 Catch up with main brandtbucher Jun 29, 2023 https://github.com/python/cpython/pull/106003/commits/6b4a5986c06132ff279e132751a79cbcab3ffacd
Clear filters https://github.com/python/cpython/pull/106003/files
Please reload this pagehttps://github.com/python/cpython/pull/106003/files
Please reload this pagehttps://github.com/python/cpython/pull/106003/files
.gitattributes https://github.com/python/cpython/pull/106003/files#diff-618cd5b83d62060ba3d027e314a21ceaf75d36067ff820db126642944145393e
dis.rst https://github.com/python/cpython/pull/106003/files#diff-eaa488fc50d23b30ca8b24ab19e9c91c1c941339847af993e908f006eec0653b
pycore_code.h https://github.com/python/cpython/pull/106003/files#diff-97ea1759f82531a45fa685065ff86bc1077c3ab3d5f65220eea48b7730032bc8
pycore_opcode.h https://github.com/python/cpython/pull/106003/files#diff-7b986d4fccffcb2f2af4ec495559b2f0dc2e393e38f95e8ca3ef48e559177530
opcode.h https://github.com/python/cpython/pull/106003/files#diff-1cd1f0bb26c3fbaa279f83ee2bfe1d9072da7af07407111c79039c66034c57ed
_opcode_metadata.py https://github.com/python/cpython/pull/106003/files#diff-3f2acff9cdbb005de538e3ba43dc12406bf414047d7d018476bac0048b5056e4
dis.py https://github.com/python/cpython/pull/106003/files#diff-96747735ee3c8aed3dd0f4c1b1ab0310eeb344577b14887cc9f6605892df47a8
_bootstrap_external.py https://github.com/python/cpython/pull/106003/files#diff-efefe383b3a81d16150c280db0b64eed7569254299418f64cc0d749f8e16f3a4
opcode.py https://github.com/python/cpython/pull/106003/files#diff-7681b13de881a13601ca56b73d052d032be48da4256df4f2f09e0474b0c1cbeb
test_compiler_codegen.py https://github.com/python/cpython/pull/106003/files#diff-9987be07783ee714c99f2e5097be8290413c27fe4e5249cafbf408194f74df6a
test_dis.py https://github.com/python/cpython/pull/106003/files#diff-fd7b118a01a9695dfa16eea9381d3c7b0652e1b7b55f51ff052a1f620d175642
2023-06-22-17-37-35.gh-issue-106003.2Vc_Tw.rst https://github.com/python/cpython/pull/106003/files#diff-0c7cdc296645e7ac24ef352d90abbabf983b923a88166b8056d9de6d3db0e6c8
bytecodes.c https://github.com/python/cpython/pull/106003/files#diff-729a985b0cb8b431cb291f1edb561bbbfea22e3f8c262451cd83328a0936a342
compile.c https://github.com/python/cpython/pull/106003/files#diff-ebc983d9f91e5bcf73500e377ac65e85863c4f77fd5b6b6caf4fcdf7c0f0b057
executor_cases.c.h https://github.com/python/cpython/pull/106003/files#diff-a1c3430c42a66c16e6d2e154491a6da993b187b27c628545a12a02c7b2a06b81
flowgraph.c https://github.com/python/cpython/pull/106003/files#diff-3cbf15668c31488528b7ab0f903c674a0ecf550f4f53c1be6cf8cd965246c2a0
generated_cases.c.h https://github.com/python/cpython/pull/106003/files#diff-4ef46fa654f95502e49a24f7dc8ee31a4cac9b3433fe9cd2b2d4dd78cfbad448
opcode_metadata.h https://github.com/python/cpython/pull/106003/files#diff-f862bc60824529a25ba378be850ecc6762f03c6c944266d30ac7172d10132498
opcode_targets.h https://github.com/python/cpython/pull/106003/files#diff-d3363a4083b77b9157d0bf07c2e87f3d3464a8b4360d5d23b07bbb23061f007a
specialize.c https://github.com/python/cpython/pull/106003/files#diff-22e653d878778ca28317261f7826545288d02fd9980cf485d0329f28a34993f2
.gitattributeshttps://github.com/python/cpython/pull/106003/files#diff-618cd5b83d62060ba3d027e314a21ceaf75d36067ff820db126642944145393e
View file https://github.com/brandtbucher/cpython/blob/6b4a5986c06132ff279e132751a79cbcab3ffacd/.gitattributes
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/106003/{{ revealButtonHref }}
https://github.com/python/cpython/pull/106003/files#diff-618cd5b83d62060ba3d027e314a21ceaf75d36067ff820db126642944145393e
https://github.com/python/cpython/pull/106003/files#diff-618cd5b83d62060ba3d027e314a21ceaf75d36067ff820db126642944145393e
Doc/library/dis.rsthttps://github.com/python/cpython/pull/106003/files#diff-eaa488fc50d23b30ca8b24ab19e9c91c1c941339847af993e908f006eec0653b
View file https://github.com/brandtbucher/cpython/blob/6b4a5986c06132ff279e132751a79cbcab3ffacd/Doc/library/dis.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/106003/{{ revealButtonHref }}
https://github.com/python/cpython/pull/106003/files#diff-eaa488fc50d23b30ca8b24ab19e9c91c1c941339847af993e908f006eec0653b
https://github.com/python/cpython/pull/106003/files#diff-eaa488fc50d23b30ca8b24ab19e9c91c1c941339847af993e908f006eec0653b
https://github.com/python/cpython/pull/106003/files#diff-eaa488fc50d23b30ca8b24ab19e9c91c1c941339847af993e908f006eec0653b
https://github.com/python/cpython/pull/106003/files#diff-eaa488fc50d23b30ca8b24ab19e9c91c1c941339847af993e908f006eec0653b
https://github.com/python/cpython/pull/106003/files#diff-eaa488fc50d23b30ca8b24ab19e9c91c1c941339847af993e908f006eec0653b
https://github.com/python/cpython/pull/106003/files#diff-eaa488fc50d23b30ca8b24ab19e9c91c1c941339847af993e908f006eec0653b
https://github.com/python/cpython/pull/106003/files#diff-eaa488fc50d23b30ca8b24ab19e9c91c1c941339847af993e908f006eec0653b
https://github.com/python/cpython/pull/106003/files#diff-eaa488fc50d23b30ca8b24ab19e9c91c1c941339847af993e908f006eec0653b
Include/internal/pycore_code.hhttps://github.com/python/cpython/pull/106003/files#diff-97ea1759f82531a45fa685065ff86bc1077c3ab3d5f65220eea48b7730032bc8
View file https://github.com/brandtbucher/cpython/blob/6b4a5986c06132ff279e132751a79cbcab3ffacd/Include/internal/pycore_code.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/106003/{{ revealButtonHref }}
https://github.com/python/cpython/pull/106003/files#diff-97ea1759f82531a45fa685065ff86bc1077c3ab3d5f65220eea48b7730032bc8
https://github.com/python/cpython/pull/106003/files#diff-97ea1759f82531a45fa685065ff86bc1077c3ab3d5f65220eea48b7730032bc8
https://github.com/python/cpython/pull/106003/files#diff-97ea1759f82531a45fa685065ff86bc1077c3ab3d5f65220eea48b7730032bc8
https://github.com/python/cpython/pull/106003/files#diff-97ea1759f82531a45fa685065ff86bc1077c3ab3d5f65220eea48b7730032bc8
Include/internal/pycore_opcode.hhttps://github.com/python/cpython/pull/106003/files#diff-7b986d4fccffcb2f2af4ec495559b2f0dc2e393e38f95e8ca3ef48e559177530
View file https://github.com/brandtbucher/cpython/blob/6b4a5986c06132ff279e132751a79cbcab3ffacd/Include/internal/pycore_opcode.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/106003/files
Please reload this pagehttps://github.com/python/cpython/pull/106003/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.