FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

memoryview lacks support for half floats · Issue #90751 · python/cpython · GitHub

Repository navigation

memoryview lacks support for half floats #90751

Closed

Description

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

    MemberAuthor

    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. added
    3.11only security fixes
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    type-featureA feature request or enhancement
    on Jan 31, 2022
  3. transferred this issue fromon Apr 10, 2022
  4. added 2 commits that reference this issue on Sep 10, 2022
  5. added 2 commits that reference this issue on Sep 10, 2022
  6. added
    3.12only security fixes
    and removed
    3.11only security fixes
    on Sep 11, 2022
  7. corona10 commented on Sep 11, 2022

    Member

    @pitrou We can close this issue right?

  8. pitrou commented on Sep 11, 2022

    MemberAuthor

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

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 fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL