- 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 formats Zd and Zf. Example:
>>> import numpy as np
>>> memoryview(np.array([1, 2, 3], dtype='F')).format
'Zf'
>>> memoryview(np.array([1, 2, 3], dtype='D')).format
'Zd'
So 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!).
Linked PRs
Reactions are currently unavailable
The D and F formats were chosen for compatibility with numpy. Problem: in fact, numpy uses buffer formats Zd and Zf. Example:
So 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!).
Linked PRs