| route-pattern | /:user_id/:repository/pull/:id/files/:range(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a7e6c3f0-6b0b-ddbd-e6ae-20e7c03ce082 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A076:1B8326:7931530:A4B1DDF:699611A1 |
| html-safe-nonce | d55633c033c56de2297232e6d8294818a870060c0e8d414408ff1c299bb2fba5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMDc2OjFCODMyNjo3OTMxNTMwOkE0QjFEREY6Njk5NjExQTEiLCJ2aXNpdG9yX2lkIjoiODU4NDE2NTc4MjY3ODAxNjQxNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 02039fe5d6631575b43d0d592b330e1c77a5f6738bae3c6b4ff8460bd3d51f32 |
| hovercard-subject-tag | pull_request:222662280 |
| 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/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
| twitter:image | https://avatars.githubusercontent.com/u/11718525?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/11718525?s=400&v=4 |
| og:image:alt | This is a version of #6493 that only preallocates the list when __len__ is available to reduce memory overallocation and possible performance hit on big iterables.
This are the L1 and L2 cache miss... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7490a2fd98baca866acf503b81aa249491b42e5b4bab7f7a2801be81175c8845 |
| 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 | 48a904441630875f5985de713035046dc65cc94c |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| Skip to content | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#start-of-content |
|
| https://github.com/ |
|
Sign in
| https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F9846%2Ffiles%2F39a87576b5a3075ec5e0a512065901b436bf8e54 |
| 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%2F9846%2Ffiles%2F39a87576b5a3075ec5e0a512065901b436bf8e54 |
|
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/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
| Reload | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
| Reload | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
|
python
| https://github.com/python |
| cpython | https://github.com/python/cpython |
| Please reload this page | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
|
Notifications
| https://github.com/login?return_to=%2Fpython%2Fcpython |
|
Fork
34.1k
| https://github.com/login?return_to=%2Fpython%2Fcpython |
|
Star
71.6k
| 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 |
| pablogsal | https://github.com/pablogsal |
| python:master | https://github.com/python/cpython/tree/master |
| pablogsal:bpo33234-2 | https://github.com/pablogsal/cpython/tree/bpo33234-2 |
|
Conversation
39
| https://github.com/python/cpython/pull/9846 |
|
Commits
10
| https://github.com/python/cpython/pull/9846/commits |
|
Checks
0
| https://github.com/python/cpython/pull/9846/checks |
|
Files changed
| https://github.com/python/cpython/pull/9846/files |
| Please reload this page | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
|
bpo-33234 Improve list() pre-sizing for inputs with known lengths (no __length_hint__)
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#top |
|
Show all changes
10 commits
| https://github.com/python/cpython/pull/9846/files |
|
7602879
Improve list() pre-sizing for inputs with known lengths
pablogsal Apr 17, 2018
| https://github.com/python/cpython/pull/9846/commits/76028798d0ddef4e6d88c0313db691592bcdd58a |
|
39a8757
Preallocate only when __len__ is available to avoid loss of performan…
pablogsal Oct 13, 2018
| https://github.com/python/cpython/pull/9846/commits/39a87576b5a3075ec5e0a512065901b436bf8e54 |
|
ab450b3
Fix NEWS entry and correct style
pablogsal Oct 15, 2018
| https://github.com/python/cpython/pull/9846/commits/ab450b3d5a453f36a4988d83b391a79bfbfa5a61 |
|
717ca67
Use _PyObject_HasLen to check if the object has lenght to avoid overhead
pablogsal Oct 23, 2018
| https://github.com/python/cpython/pull/9846/commits/717ca6732b8a15b24542648bdba56812b5ef6867 |
|
b678442
Simplify implementation and don't capture all expections on error
pablogsal Oct 23, 2018
| https://github.com/python/cpython/pull/9846/commits/b67844271da9a4cb3046820be74bf6e0c7b46927 |
|
b40bd62
Add assert and fix formatting
pablogsal Oct 25, 2018
| https://github.com/python/cpython/pull/9846/commits/b40bd623c5536dd90a4cc8ebbc72fc5ff0889ca3 |
|
3837486
Remove uneeded test modification
pablogsal Oct 25, 2018
| https://github.com/python/cpython/pull/9846/commits/38374862963005541cb0af9b7a9beb2c7a98b467 |
|
b6ff7ce
Don't preallocate if list is modified when calling PyObject_Size
pablogsal Oct 26, 2018
| https://github.com/python/cpython/pull/9846/commits/b6ff7ce618bc958a4be4cf29aa98a622cf4cebea |
|
e7f8c46
Improve readability in the error handling branch
pablogsal Oct 26, 2018
| https://github.com/python/cpython/pull/9846/commits/e7f8c464258acf2e82278909fb5e1a792aa65dbf |
|
0a6c8ba
Capture only TypeError as suggested by Serhiy
pablogsal Oct 28, 2018
| https://github.com/python/cpython/pull/9846/commits/0a6c8ba7d2bc269767e0bdbec283b36f59817d22 |
|
Clear filters
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
| Please reload this page | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
| Please reload this page | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
|
test_descr.py
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-6b813570d02ae3544e7e0233ae21d647f8e2dc47486495557e8d16c80460e85b |
|
test_list.py
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-af5c4ee62cca27529efe0febc3babfd5745cc1ae48a280a58605a8c85ee38942 |
|
2018-04-17-01-24-51.bpo-33234.l9IDtp.rst
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-f69f0dc0516d28a1acd579c1ac914a1044bffcc69ab8387a9dc5ee1c111b7749 |
|
listobject.c
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-67a42c5c0990c7aceea040ffc07905299aab97d64dc49adb256f85340b2c7e81 |
| Lib/test/test_descr.py | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-6b813570d02ae3544e7e0233ae21d647f8e2dc47486495557e8d16c80460e85b |
|
View file
| https://github.com/pablogsal/cpython/blob/39a87576b5a3075ec5e0a512065901b436bf8e54/Lib/test/test_descr.py |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/python/cpython/pull/9846/files/{{ revealButtonHref }} |
|
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-6b813570d02ae3544e7e0233ae21d647f8e2dc47486495557e8d16c80460e85b |
|
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-6b813570d02ae3544e7e0233ae21d647f8e2dc47486495557e8d16c80460e85b |
| Lib/test/test_list.py | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-af5c4ee62cca27529efe0febc3babfd5745cc1ae48a280a58605a8c85ee38942 |
|
View file
| https://github.com/pablogsal/cpython/blob/39a87576b5a3075ec5e0a512065901b436bf8e54/Lib/test/test_list.py |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/python/cpython/pull/9846/files/{{ revealButtonHref }} |
|
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-af5c4ee62cca27529efe0febc3babfd5745cc1ae48a280a58605a8c85ee38942 |
|
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-af5c4ee62cca27529efe0febc3babfd5745cc1ae48a280a58605a8c85ee38942 |
| Misc/NEWS.d/next/Core and Builtins/2018-04-17-01-24-51.bpo-33234.l9IDtp.rst | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-f69f0dc0516d28a1acd579c1ac914a1044bffcc69ab8387a9dc5ee1c111b7749 |
|
View file
| https://github.com/pablogsal/cpython/blob/39a87576b5a3075ec5e0a512065901b436bf8e54/Misc/NEWS.d/next/Core%20and%20Builtins/2018-04-17-01-24-51.bpo-33234.l9IDtp.rst |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/python/cpython/pull/9846/files/{{ revealButtonHref }} |
| vstinner | https://github.com/vstinner |
| Oct 15, 2018 | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#r225313835 |
| Learn more | https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment |
| Please reload this page | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
| vstinner | https://github.com/vstinner |
| Oct 15, 2018 | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#r225313962 |
| Learn more | https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment |
| Please reload this page | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
| Objects/listobject.c | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-67a42c5c0990c7aceea040ffc07905299aab97d64dc49adb256f85340b2c7e81 |
|
View file
| https://github.com/pablogsal/cpython/blob/39a87576b5a3075ec5e0a512065901b436bf8e54/Objects/listobject.c |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/python/cpython/pull/9846/files/{{ revealButtonHref }} |
|
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-67a42c5c0990c7aceea040ffc07905299aab97d64dc49adb256f85340b2c7e81 |
| serhiy-storchaka | https://github.com/serhiy-storchaka |
| Oct 23, 2018 | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#r227510433 |
| Learn more | https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment |
| Please reload this page | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
| Please reload this page | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
|
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-67a42c5c0990c7aceea040ffc07905299aab97d64dc49adb256f85340b2c7e81 |
|
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-67a42c5c0990c7aceea040ffc07905299aab97d64dc49adb256f85340b2c7e81 |
| vstinner | https://github.com/vstinner |
| Oct 23, 2018 | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#r227373110 |
| Learn more | https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment |
| Please reload this page | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
| pablogsal | https://github.com/pablogsal |
| Oct 23, 2018 | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#r227376580 |
| Learn more | https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment |
| Please reload this page | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
| vstinner | https://github.com/vstinner |
| Oct 15, 2018 | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#r225314645 |
| Learn more | https://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment |
| Please reload this page | https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54 |
|
| https://github.com/python/cpython/pull/9846/files/39a87576b5a3075ec5e0a512065901b436bf8e54#diff-67a42c5c0990c7aceea040ffc07905299aab97d64dc49adb256f85340b2c7e81 |
|
| 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 |