Skip to content

Treat NoneType fields as None/missing during deserialization of mappings #79

Description

@tamasfe

MCVE:

Rust side:

#[derive(Deserialize)]
struct Foo {
  #[serde(default)]
  foo: bool,
}

python side:

foo = {
  "foo": None,
}

depythonize::<Foo>(...) will fail with unexpected type: 'NoneType' object cannot be converted to '...'. However {} as input will work.

As far as I've looked, a check might be missing around here:

seed.deserialize(&mut Depythonizer::from_object(&item))

If that's the case I can look into it open PR with the fix.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions