Skip to content

memoryview on array with datetime/timedelta-dtype triggers SystemError on Python 3.5 #7270

Closed

Description

@gerritholl

On Python 3.5, constructing a memoryview for an ndarray containing a datetime/timedelta-dtype leads to a SystemError: <class 'memoryview'> returned a result with an error set:

In [50]: memoryview(numpy.zeros(10, dtype=[("A", "m8[s]")]))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
ValueError: cannot include dtype 'm' in a buffer

During handling of the above exception, another exception occurred:

SystemError                               Traceback (most recent call last)
<ipython-input-50-5d5ac6c085fa> in <module>()
----> 1 memoryview(numpy.zeros(10, dtype=[("A", "m8[s]")]))

SystemError: <class 'memoryview'> returned a result with an error set

Prior to Python 3.4, results for the same were unpredictable and bizarre, see this Stack Exchange question.

I am aware that datetime64 and timedelta64 do not support the buffer protocol (see #4983), but the another exception occurred should not happen.

This appears to be related to Python issue 23571, although I can't say I quite understand what's going on.

Activity

  1. gerritholl commented on Feb 17, 2016

    @gerritholl
    ContributorAuthor

    Or should this still be considered an upstream bug?

  2. augurar commented on Aug 10, 2016

    @augurar

    Yes, this is an upstream bug. It seems that memoryview() is setting an error but returning a non-null result. Handling of this case changed in Python 3.5, so the SystemError is expected behavior.

  3. eric-wieser commented on Mar 1, 2019

    @eric-wieser
    Member

    I can't reproduce this any more in 1.15.4, despite the fact that nothing seems to have changed upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions