Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add support for numpy buffer format Zf and Zd #148675

Copy link
Copy link
@vstinner

Description

@vstinner
Issue body actions
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
    No fields configured for issues without a type.

    Projects

    Status
    Done
    Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.