Title: Add support for numpy buffer format `Zf` and `Zd` · Issue #148675 · python/cpython · GitHub
Open Graph Title: Add support for numpy buffer format `Zf` and `Zd` · Issue #148675 · python/cpython
X Title: Add support for numpy buffer format `Zf` and `Zd` · Issue #148675 · python/cpython
Description: Python 3.14 added D and F formats to the ctypes and struct module Python 3.15 adds D and F formats to the array module and to memoryview The D and F formats were chosen for compatibility with numpy. Problem: in fact, numpy uses buffer fo...
Open Graph Description: Python 3.14 added D and F formats to the ctypes and struct module Python 3.15 adds D and F formats to the array module and to memoryview The D and F formats were chosen for compatibility with numpy...
X Description: Python 3.14 added D and F formats to the ctypes and struct module Python 3.15 adds D and F formats to the array module and to memoryview The D and F formats were chosen for compatibility with numpy...
Opengraph URL: https://github.com/python/cpython/issues/148675
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add support for numpy buffer format `Zf` and `Zd`","articleBody":"* Python 3.14 added `D` and `F` formats to the ctypes and `struct` module\n* Python 3.15 adds `D` and `F` formats to the `array` module and to `memoryview`\n\nThe `D` and `F` formats were chosen for [compatibility with numpy](https://github.com/python/cpython/pull/132827). Problem: in fact, numpy uses buffer formats `Zd` and `Zf`. Example:\n\n```py\n\u003e\u003e\u003e import numpy as np\n\u003e\u003e\u003e memoryview(np.array([1, 2, 3], dtype='F')).format\n'Zf'\n\u003e\u003e\u003e memoryview(np.array([1, 2, 3], dtype='D')).format\n'Zd'\n```\n\nSo I propose adding support for `Zd` and `Zf` formats in `array`, `ctypes`, `memoryview` and `struct`. It requires changing the code expecting a single character to now accept a string (`Zd` and `Zf` have 2 characters!).\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-148676\n* gh-148674\n* gh-149368\n* gh-149455\n* gh-149778\n* gh-149779\n* gh-149869\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2026-04-17T11:53:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/148675/cpython/issues/148675"}
| 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:d45ecc70-a17d-044f-1a6f-fcadd93da770 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CEDC:25A463:362535:37A6B1:6A519A14 |
| html-safe-nonce | 308d0e5fec28003fb8049f8f0680d4b7155bc1541c488df21caee9a985229f2b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRURDOjI1QTQ2MzozNjI1MzU6MzdBNkIxOjZBNTE5QTE0IiwidmlzaXRvcl9pZCI6IjM4MjU3NDQ5OTgzMjM4MjEwNzYiLCJyZWdpb25fZWRnZSI6InNlYSIsInJlZ2lvbl9yZW5kZXIiOiJzZWEifQ== |
| visitor-hmac | 9a8c734d6897e32993bb456b12c8c19ecf0dc5402c58fcf637cf38f31eebd35c |
| hovercard-subject-tag | issue:4282375344 |
| 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/148675/issue_layout |
| twitter:image | https://opengraph.githubassets.com/49fc01152162dd3351e6c789a53b146d95e6bf13964dc61431eabe6af128e34a/python/cpython/issues/148675 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/49fc01152162dd3351e6c789a53b146d95e6bf13964dc61431eabe6af128e34a/python/cpython/issues/148675 |
| og:image:alt | Python 3.14 added D and F formats to the ctypes and struct module Python 3.15 adds D and F formats to the array module and to memoryview The D and F formats were chosen for compatibility with numpy... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vstinner |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width