Skip to content

deepcopy memoryview raises TypeError #95081

@stuaxo

Description

@stuaxo

Bug report

Calling deepcopy on a memoryview raises a TypeError, this looks similar to bug 82474 #82474

This also breaks BinaryField when using Django Polymorphic

jazzband/django-polymorphic#524
Your environment

  • CPython versions tested on: 3.8, 3.10
  • Operating system and architecture: Ubuntu 21.10
>>> a = memoryview(b'123')
>>> from copy import deepcopy
>>> deepcopy(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.10/copy.py", line 161, in deepcopy
    rv = reductor(4)
TypeError: cannot pickle 'memoryview' object

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions