René's URL Explorer Experiment


Title: bpo-43574: Dont overallocate list literals by chadnetzer · Pull Request #24954 · python/cpython · GitHub

Open Graph Title: bpo-43574: Dont overallocate list literals by chadnetzer · Pull Request #24954 · python/cpython

X Title: bpo-43574: Dont overallocate list literals by chadnetzer · Pull Request #24954 · python/cpython

Description: Before v3.9, list literals weren't over-allocated, but this behavior regressed starting with v3.9: Switched to initializing list literals w/ LIST_EXTEND https://bugs.python.org/issue39320 #17984 Commit where over-allocation of list literals first appeared https://bugs.python.org/issue38328 #17114 6dd9b64 This changes to the original behavior of not over-allocating lists for list literals, by not over-allocating any 0-length list that is extended. Technically this is a change in behavior, as lists that are initialized to length 0, and then immediately extended, will not be over-allocated on that initial extension. This change in behavior is likely innocuous, and possibly desirable, whereas the long-standing Python behavior of not using over-allocation for list literals is almost certainly desired. Adds a test_overallocation test for lists to find regressions (assuming the regression doesn't alter the behavior of both the list-literal and list-initialization from a known length). https://bugs.python.org/issue43574

Open Graph Description: Before v3.9, list literals weren't over-allocated, but this behavior regressed starting with v3.9: Switched to initializing list literals w/ LIST_EXTEND https://bugs.python.org/issue39320 #1798...

X Description: Before v3.9, list literals weren't over-allocated, but this behavior regressed starting with v3.9: Switched to initializing list literals w/ LIST_EXTEND https://bugs.python.org/issue39320 #...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:a019972e-6dfd-0613-3d7d-6704e0a997dc
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9732:2C2C4D:101C70:168FA8:696A6D8B
html-safe-nonce2f9960becd89ed0b10de71d2b853cc241370d80893f55765be8f7d2108cbe440
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzMyOjJDMkM0RDoxMDFDNzA6MTY4RkE4OjY5NkE2RDhCIiwidmlzaXRvcl9pZCI6Ijc4NDM0NDY5NDgxODg4MTA2MzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacd204726cbbf1f74c424601b79e1e0cd87aac3c9e9c7203b3997cea613e1a392c
hovercard-subject-tagpull_request:597408477
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/24954/files
twitter:imagehttps://avatars.githubusercontent.com/u/122251?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/122251?s=400&v=4
og:image:altBefore v3.9, list literals weren't over-allocated, but this behavior regressed starting with v3.9: Switched to initializing list literals w/ LIST_EXTEND https://bugs.python.org/issue39320 #1798...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None6fea32d5b7276b841b7a803796d9715bc6cfb31ed549fdf9de2948ac25d12ba6
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
releasef2d9f6432a5a115ec709295ae70623f33bb80aee
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/24954/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F24954%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%2F24954%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/24954/files
Reloadhttps://github.com/python/cpython/pull/24954/files
Reloadhttps://github.com/python/cpython/pull/24954/files
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/24954/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/24954/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
chadnetzerhttps://github.com/chadnetzer
python:mainhttps://github.com/python/cpython/tree/main
chadnetzer:bpo43574-dont-overallocate-list-literalshttps://github.com/chadnetzer/cpython/tree/bpo43574-dont-overallocate-list-literals
Conversation 33 https://github.com/python/cpython/pull/24954
Commits 11 https://github.com/python/cpython/pull/24954/commits
Checks 0 https://github.com/python/cpython/pull/24954/checks
Files changed https://github.com/python/cpython/pull/24954/files
Please reload this pagehttps://github.com/python/cpython/pull/24954/files
bpo-43574: Dont overallocate list literals https://github.com/python/cpython/pull/24954/files#top
Show all changes 11 commits https://github.com/python/cpython/pull/24954/files
4dbee9a Add testcase for bpo-43574 list overallocaton chadnetzer Mar 21, 2021 https://github.com/python/cpython/pull/24954/commits/4dbee9ad373de2948503d8e053c337f792286ef4
5b31470 Don't overallocate when extending an empty list chadnetzer Mar 21, 2021 https://github.com/python/cpython/pull/24954/commits/5b31470b03dcabd9f687022ed724348ccc01fb7b
172f2c0 Skip overallocation calc when not overallocating chadnetzer Mar 21, 2021 https://github.com/python/cpython/pull/24954/commits/172f2c0a4014805890ec7cbd16ea3625a569e249
d76ae2a Fix list_extend() init list changes to PEP-7 form chadnetzer Mar 22, 2021 https://github.com/python/cpython/pull/24954/commits/d76ae2a9adb9892514e804a47b77cd5738ff5195
7aad246 bpo-43574: Add NEWS chadnetzer Mar 22, 2021 https://github.com/python/cpython/pull/24954/commits/7aad246f17772e19d115a1dcd8f670dfa92fb22d
7c20c6c Add more list overallocation regression tests chadnetzer Mar 22, 2021 https://github.com/python/cpython/pull/24954/commits/7c20c6cc15873cbbc7f94c06727ce1f85c27b855
7be3ae8 Put common-case first in logical-or list_resize() chadnetzer Mar 22, 2021 https://github.com/python/cpython/pull/24954/commits/7be3ae871e2e435fbe67c372c3dfaeca8cfa0927
7436223 Adjust NEWS entry language based on PR feedback chadnetzer Mar 23, 2021 https://github.com/python/cpython/pull/24954/commits/7436223a71b2ed46fff050d956d5effa5acbd549
657d51f Allow empty list append/insert to overallocate chadnetzer Mar 24, 2021 https://github.com/python/cpython/pull/24954/commits/657d51fcb25d7653fff91c044fde3452b2bce056
4336cc6 Update test_overallocation of empty list append() chadnetzer Mar 26, 2021 https://github.com/python/cpython/pull/24954/commits/4336cc6060188b1af9976dd785696b53b865031e
19d4374 Add direct test of list-literal non-overallocation chadnetzer Apr 5, 2021 https://github.com/python/cpython/pull/24954/commits/19d43741f7cf16a1bf6e9a9094e469836a3d5c4d
Clear filters https://github.com/python/cpython/pull/24954/files
Please reload this pagehttps://github.com/python/cpython/pull/24954/files
Please reload this pagehttps://github.com/python/cpython/pull/24954/files
test_list.py https://github.com/python/cpython/pull/24954/files#diff-af5c4ee62cca27529efe0febc3babfd5745cc1ae48a280a58605a8c85ee38942
2021-03-21-18-51-30.bpo-43574.mteI-I.rst https://github.com/python/cpython/pull/24954/files#diff-38a6ab0241f049dd9acd736bb895e992baed7c815cd553bd77b4926b04bb7656
listobject.c https://github.com/python/cpython/pull/24954/files#diff-67a42c5c0990c7aceea040ffc07905299aab97d64dc49adb256f85340b2c7e81
Lib/test/test_list.pyhttps://github.com/python/cpython/pull/24954/files#diff-af5c4ee62cca27529efe0febc3babfd5745cc1ae48a280a58605a8c85ee38942
View file https://github.com/chadnetzer/cpython/blob/19d43741f7cf16a1bf6e9a9094e469836a3d5c4d/Lib/test/test_list.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/24954/{{ revealButtonHref }}
https://github.com/python/cpython/pull/24954/files#diff-af5c4ee62cca27529efe0febc3babfd5745cc1ae48a280a58605a8c85ee38942
https://github.com/python/cpython/pull/24954/files#diff-af5c4ee62cca27529efe0febc3babfd5745cc1ae48a280a58605a8c85ee38942
https://github.com/python/cpython/pull/24954/files#diff-af5c4ee62cca27529efe0febc3babfd5745cc1ae48a280a58605a8c85ee38942
gpsheadhttps://github.com/gpshead
Apr 11, 2021https://github.com/python/cpython/pull/24954/files#r611250698
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/24954/files
gpsheadhttps://github.com/gpshead
Apr 11, 2021https://github.com/python/cpython/pull/24954/files#r611250589
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/24954/files
sweeneydehttps://github.com/sweeneyde
Apr 11, 2021https://github.com/python/cpython/pull/24954/files#r611253116
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/24954/files
gpsheadhttps://github.com/gpshead
Apr 11, 2021https://github.com/python/cpython/pull/24954/files#r611250374
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/24954/files
gpsheadhttps://github.com/gpshead
Apr 11, 2021https://github.com/python/cpython/pull/24954/files#r611250284
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/24954/files
gpsheadhttps://github.com/gpshead
Apr 11, 2021https://github.com/python/cpython/pull/24954/files#r611250669
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/24954/files
https://github.com/python/cpython/pull/24954/files#diff-af5c4ee62cca27529efe0febc3babfd5745cc1ae48a280a58605a8c85ee38942
Misc/NEWS.d/next/Core and Builtins/2021-03-21-18-51-30.bpo-43574.mteI-I.rsthttps://github.com/python/cpython/pull/24954/files#diff-38a6ab0241f049dd9acd736bb895e992baed7c815cd553bd77b4926b04bb7656
View file https://github.com/chadnetzer/cpython/blob/19d43741f7cf16a1bf6e9a9094e469836a3d5c4d/Misc/NEWS.d/next/Core%20and%20Builtins/2021-03-21-18-51-30.bpo-43574.mteI-I.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/24954/{{ revealButtonHref }}
gpsheadhttps://github.com/gpshead
Apr 11, 2021https://github.com/python/cpython/pull/24954/files#r611250768
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/24954/files
Objects/listobject.chttps://github.com/python/cpython/pull/24954/files#diff-67a42c5c0990c7aceea040ffc07905299aab97d64dc49adb256f85340b2c7e81
View file https://github.com/chadnetzer/cpython/blob/19d43741f7cf16a1bf6e9a9094e469836a3d5c4d/Objects/listobject.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/24954/{{ revealButtonHref }}
https://github.com/python/cpython/pull/24954/files#diff-67a42c5c0990c7aceea040ffc07905299aab97d64dc49adb256f85340b2c7e81
https://github.com/python/cpython/pull/24954/files#diff-67a42c5c0990c7aceea040ffc07905299aab97d64dc49adb256f85340b2c7e81
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.