Skip to content

pydantic BaseModel cannot be pickled w/ cloudpickle >= 1.3 #403

Description

@marco-neumann-by

Example

importcloudpickleimportpydanticclassBar(pydantic.BaseModel):
passif__name__=='__main__':
cloudpickle.loads(cloudpickle.dumps(Bar()))

Technical Background

The issue is the interaction between:

https://github.com/samuelcolvin/pydantic/blob/de0657e4a5495de9378db9fe15a17334c2b0fae5/pydantic/main.py#L865-L868

and:

is_litteral=getattr(obj, '__values__', None) isnotNone

Refs

This was originally discussed in #393.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions