Title: Avoid parsing a format string for each float or complex `array` item · Issue #162507 · python/cpython · GitHub
Open Graph Title: Avoid parsing a format string for each float or complex `array` item · Issue #162507 · python/cpython
X Title: Avoid parsing a format string for each float or complex `array` item · Issue #162507 · python/cpython
Description: Feature or enhancement When floats is a list, array('d', floats) calls d_setitem() for each element. The setter passes the same d format over and over to PyArg_Parse(). The setters can call PyFloat_AsDouble() directly for e, f, and d, an...
Open Graph Description: Feature or enhancement When floats is a list, array('d', floats) calls d_setitem() for each element. The setter passes the same d format over and over to PyArg_Parse(). The setters can call PyFloat...
X Description: Feature or enhancement When floats is a list, array('d', floats) calls d_setitem() for each element. The setter passes the same d format over and over to PyArg_Parse(). The setters can call...
Opengraph URL: https://github.com/python/cpython/issues/162507
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Avoid parsing a format string for each float or complex `array` item","articleBody":"### Feature or enhancement\n\nWhen `floats` is a list, `array('d', floats)` calls [`d_setitem()`](https://github.com/python/cpython/blob/1590d78fc37ce88435cc0522f928861e6586bc25/Modules/arraymodule.c#L629-L641) for each element. The setter passes the same `d` format over and over to `PyArg_Parse()`.\n\nThe setters can call [`PyFloat_AsDouble()`](https://github.com/python/cpython/blob/1590d78fc37ce88435cc0522f928861e6586bc25/Python/getargs.c#L920-L927) directly for `e`, `f`, and `d`, and [`PyComplex_AsCComplex()`](https://github.com/python/cpython/blob/1590d78fc37ce88435cc0522f928861e6586bc25/Python/getargs.c#L930-L938) for `Zf` and `Zd`.\n\n### Has this already been discussed elsewhere?\n\nNo response given\n\n### Links to previous discussion of this feature:\n\n_No response_\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-162509\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/maurycy","@type":"Person","name":"maurycy"},"datePublished":"2026-11-23T22:07:22Z","url":"https://github.com/python/cpython/issues/162507"}
| 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 | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a43774ad-a354-3b52-b0f9-77c368cec45d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8FD2:B03C5:CC7B2D:115528C:6B064C06 |
| html-safe-nonce | 0155abcef450480f6ef7346c24a7ae331ce9b990d325ed29c8378542e1dbed14 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RkQyOkIwM0M1OkNDN0IyRDoxMTU1MjhDOjZCMDY0QzA2IiwidmlzaXRvcl9pZCI6IjEyNDIyNTM0ODAzNzk2OTgxODIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 351e39ff3b44d446e4d1824d74e058a407dac7420f3877946635369f2a3462a7 |
| hovercard-subject-tag | issue:6569808899 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/cpython/162507/issue_layout |
| twitter:image | https://opengraph.githubassets.com/de4fbdc1d57777a2f76b24a351b624ca4bd43f710dbfa377646e0bc4504af776/python/cpython/issues/162507 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/de4fbdc1d57777a2f76b24a351b624ca4bd43f710dbfa377646e0bc4504af776/python/cpython/issues/162507 |
| og:image:alt | Feature or enhancement When floats is a list, array('d', floats) calls d_setitem() for each element. The setter passes the same d format over and over to PyArg_Parse(). The setters can call PyFloat... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | maurycy |
| hostname | github.com |
| expected-hostname | github.com |
| None | 772b6997ca4daa0428dd49a25d76052e765555ae560fe9c88517eb828bbd861e |
| turbo-cache-control | no-preview |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f1f9a08f7c769a37f1dfc18ad43d463c222a7eea |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width