Skip to content

Unstructuring a tuple of objects no longer works #125

@gmacon

Description

@gmacon
  • cattrs version: 1.2.0
  • Python version: 3.7.9
  • Operating System: Linux

Description

There are a few spots in the code where I unstructure a tuple of attrs objects in preparation for JSON-encoding them. This stopped working with 1.2.0.

What I Did

Here's a minimal reproducer:

#!/usr/bin/env python3

import attr
import cattr

@attr.define()
class Foo:
    foo: str

assert cattr.unstructure((Foo("foo"),)) == ({"foo": "foo"},)

I've bisected this to 53fd2ad. From looking at that commit quickly, I'm guessing that switching from _subclass(Sequence) to is_sequence is causing a tuple to no longer be considered a sequence.

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