GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — memoryview lacks support for half floats · Issue #90751 · python/cpython

memoryview lacks support for half floats #90751

New issue
Copy link
New issue
Copy link
Closed
Closed
memoryview lacks support for half floats#90751
Copy link
Labels
3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement

Description

@pitrou
pitrou
opened on Jan 31, 2022
Issue body actions
BPO 46593
Nosy @mdickinson, @pitrou, @meadori, @corona10

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2022-01-31.15:29:00.019>
labels = ['interpreter-core', 'type-feature', '3.11']
title = 'memoryview lacks support for half floats'
updated_at = <Date 2022-01-31.15:54:50.040>
user = 'https://github.com/pitrou'

bugs.python.org fields:

activity = <Date 2022-01-31.15:54:50.040>
actor = 'corona10'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Interpreter Core']
creation = <Date 2022-01-31.15:29:00.019>
creator = 'pitrou'
dependencies = []
files = []
hgrepos = []
issue_num = 46593
keywords = []
message_count = 1.0
messages = ['412205']
nosy_count = 4.0
nosy_names = ['mark.dickinson', 'pitrou', 'meador.inge', 'corona10']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue46593'
versions = ['Python 3.11']

Activity

  1. pitrou commented on Jan 31, 2022

    @pitrou
    pitrou
    on Jan 31, 2022
    MemberAuthor
    More actions

    The struct module has support for half-floats (the "e" format code) but support is not fully enabled in the memoryview object.

    Let's contrast float32 (the "f" format code), which you can cast to, and read as Python objects:

    >>> a = np.array([0.0, -1.5], np.float32())
    >>> list(memoryview(a))
    [0.0, -1.5]
    >>> memoryview(a.tobytes()).cast('f').tolist()
    [0.0, -1.5]
    

    and float16, where support is minimal (casting forbidden, reading as Python objects unimplemented):

    >>> a = np.array([0.0, -1.5], np.float16())
    >>> list(memoryview(a))
    Traceback (most recent call last):
      File "<ipython-input-15-102982f8ac8e>", line 1, in <module>
        list(memoryview(a))
    NotImplementedError: memoryview: format e not supported
    
    >>> memoryview(a.tobytes()).cast('e').tolist()
    Traceback (most recent call last):
      File "<ipython-input-25-78df215a7360>", line 1, in <module>
        memoryview(a.tobytes()).cast('e').tolist()
    ValueError: memoryview: destination format must be a native single character format prefixed with an optional '@'
    
  2. pitrou
    added
    3.11only security fixesonly security fixes
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    type-featureA feature request or enhancementA feature request or enhancement
    on Jan 31, 2022
  3. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  4. corona10
    added 2 commits that reference this issue on Sep 10, 2022

    pythongh-90751: memoryview supports half-float

    3d897a2

    pythongh-90751: memoryview supports half-float

    61e926c
  5. pitrou
    added 2 commits that reference this issue on Sep 10, 2022

    Merge branch 'pythongh-90751' of https://github.com/corona10/cpython …

    abf2050

    gh-90751: memoryview now supports half-float (#96738)

    8d75a13
  6. corona10
    added
    3.12only security fixesonly security fixes
    and removed
    3.11only security fixesonly security fixes
    on Sep 11, 2022
  7. corona10 commented on Sep 11, 2022

    @corona10
    corona10
    on Sep 11, 2022
    Member
    More actions

    @pitrou We can close this issue right?

  8. pitrou commented on Sep 11, 2022

    @pitrou
    pitrou
    on Sep 11, 2022
    MemberAuthor
    More actions

    Ah, sorry, I forgot it. Yes, we can.

  9. pitrou
    closed this as completedon Sep 11, 2022
  10. serhiy-storchaka
    added this to Struct, memoryview and array issues 🏗️on Jul 13, 2026
  11. github-project-automation
    moved this to Todo in Struct, memoryview and array issues 🏗️on Jul 13, 2026
  12. github-project-automation
    moved this from Todo to Done in Struct, memoryview and array issues 🏗️on Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement

    Projects

    • Struct, memoryview and array issues 🏗️
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.