Skip to content

Parameters object is not pickle-able #78

Description

@hdoupe

For some reason, marshmallow Schemas are not pickle-able if type is used to generate them:

Works just fine:

classSchema1(ma.Schema):
a=ma.fields.Str()
schema1=Schema1()
pickle.dump(schema1, open("schema1.pickle", "wb"))

Breaks:

Schema2=type(
"Schema2",
(ma.Schema, ),
{"a": ma.fields.Str()}
)
schema2=Schema2()
pickle.dump(schema2, open("schema2.pickle", "wb"))
# ---------------------------------------------------------------------------# PicklingError Traceback (most recent call last)# <ipython-input-3-3309ac14ecbf> in <module># 6 # 7 schema2 = Schema2()# ----> 8 pickle.dump(schema2, open("schema2.pickle", "wb"))# PicklingError: Can't pickle <class 'marshmallow.schema.Schema2'>: attribute lookup Schema2 on marshmallow.schema failed

Thanks for the bug report @jdebacker.

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