Title: gh-150942: Speed up FrameLocalsProxy.values() by catlover-bot · Pull Request #156055 · python/cpython · GitHub
Open Graph Title: gh-150942: Speed up FrameLocalsProxy.values() by catlover-bot · Pull Request #156055 · python/cpython
X Title: gh-150942: Speed up FrameLocalsProxy.values() by catlover-bot · Pull Request #156055 · python/cpython
Description: Summary Use _PyList_AppendTakeRef() when adding owned values returned by framelocalsproxy_getval() to FrameLocalsProxy.values(). framelocalsproxy_getval() returns a new reference. Transferring it directly to the result list avoids the extra incref/decref pair from PyList_Append(). This update merges current main (9d22a5334bd5273962adceeb697a1337e9a0ca21) into the existing PR branch and preserves its duplicate-local-name filtering: First occurrences transfer their owned reference to the list. Duplicate values and deduplication-error paths release the unused reference. Extra-locals values remain borrowed and continue to use PyList_Append(). Add a mortal-object regression covering ordinary locals, duplicate local names, extra locals, and reference release after clearing the frame/list. A NEWS entry is included. Performance The earlier pyperf results used a baseline from before the upstream local-name deduplication change. They do not establish the performance of this updated implementation, so the old numerical speedup claims have been removed. No numerical performance claim is made for the current head. Controlled same-lineage pyperf measurements are still needed. Validation Rebuilt and tested the updated source on Linux x86-64 with GCC 14.2.0: Debug, release, and free-threaded debug builds: python -m test test_frame test_listcomps passed (156 tests per build, 9 skips). Debug and free-threaded debug builds: python -m test -R 3:3 test_frame test_listcomps passed with no positive reference leaks. Allocation-failure sweeps with distinct mortal objects passed on all three builds; every attempt reclaimed all values. test_scope, test_inspect, test_trace, test_generators, and test_genexps passed (517 tests, 1 skip). Change-only git diff --check, CPython patchcheck, Python compilation, and indentation checks passed. The nine focused-test skips include eight existing mapping-protocol skips and one _ctypes-dependent C API test because that optional build dependency was unavailable. The full test suite, complete pre-commit lint, sanitizers, and PGO/LTO benchmarks were not run locally; remote CI remains separate. AI assistance was used to prepare the merge conflict resolution, regression test, and local verification. Issue: gh-150942
Open Graph Description: Summary Use _PyList_AppendTakeRef() when adding owned values returned by framelocalsproxy_getval() to FrameLocalsProxy.values(). framelocalsproxy_getval() returns a new reference. Transferring it d...
X Description: Summary Use _PyList_AppendTakeRef() when adding owned values returned by framelocalsproxy_getval() to FrameLocalsProxy.values(). framelocalsproxy_getval() returns a new reference. Transferring it d...
Opengraph URL: https://github.com/python/cpython/pull/156055
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:3406881a-f77c-e584-e26d-1b6f84efac85 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CC50:B1B84:3252096:4005DD6:6B020CDE |
| html-safe-nonce | bf1127024807a7b803121b502af2a853164074981ee6717990a3efb88850ebf4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzUwOkIxQjg0OjMyNTIwOTY6NDAwNURENjo2QjAyMENERSIsInZpc2l0b3JfaWQiOiI3MTE3MzI2OTk5NjI2MDU4OTc0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2d58931d39a08edbae8f2be5ea1f20884048768ceb2ff4766906b734bee2cc98 |
| hovercard-subject-tag | pull_request:4314703208 |
| 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 | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/156055/files |
| twitter:image | https://avatars.githubusercontent.com/u/203637895?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/203637895?s=400&v=4 |
| og:image:alt | Summary Use _PyList_AppendTakeRef() when adding owned values returned by framelocalsproxy_getval() to FrameLocalsProxy.values(). framelocalsproxy_getval() returns a new reference. Transferring it d... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width