Skip to content

Can't pickle UFuncTypeError #16490

@crusaderky

Description

@crusaderky

numpy 1.18.4-py38h8854b6b_0 (conda-forge)
Linux x64

import pickle
import numpy


try:
    numpy.ones(1) * "foo"
except Exception as e:
    pickle.dumps(e)

Output:

Traceback (most recent call last):
  File "ufunctypeerror.py", line 6, in <module>
    numpy.ones(1) * "foo"
numpy.core._exceptions.UFuncTypeError: ufunc 'multiply' did not contain a loop with signature matching types (dtype('<U32'), dtype('<U32')) -> dtype('<U32')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "ufunctypeerror.py", line 8, in <module>
    pickle.dumps(e)
_pickle.PicklingError: Can't pickle <class 'numpy.core._exceptions.UFuncTypeError'>: it's not the same object as numpy.core._exceptions.UFuncTypeError

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions