Skip to content

Can't pickle sre_constants #92049

Closed
@charmoniumQ

Description

@charmoniumQ

Bug report

In [30]: import pickle, sre_constants

In [31]: a = pickle.dumps(sre_constants.SUCCESS)

In [32]: pickle.loads(a)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-32-7038544c8e94> in <cell line: 1>()
----> 1 pickle.loads(a)

TypeError: __new__() missing 1 required positional argument: 'name'

Even if we decide sre_constants.* are not picklable, the TypeError should happen when trying to dump, not when trying to load. This could cause a user to write pickle files they can't ever read.

Your environment

  • CPython versions tested on: 3.9, 3.10
  • Operating system and architecture: Ubuntu 20.04 x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions