Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

mattpap
Copy link
Contributor

@mattpap mattpap commented Feb 26, 2025

fixes #14293

@mattpap mattpap added this to the 3.7 milestone Feb 26, 2025
@mattpap
Copy link
Contributor Author

mattpap commented Feb 26, 2025

Currently we have:

class Seq(ContainerProperty[T]):

   @classmethod
    def _is_seq_like(cls, value: Any) -> bool:
        return (isinstance(value, Container | Sized | Iterable)
                and hasattr(value, "__getitem__") # NOTE: this is what makes it disallow set type
                and not isinstance(value, Mapping))

but also:

class Set(Seq[T]):

Either Seq should allow set or Set shouldn't inherit from Seq.

@bryevdv
Copy link
Member

bryevdv commented Feb 26, 2025

IMO set should not be a sequence.

@mattpap mattpap force-pushed the mattpap/14293_serialize_unstable branch from 664e25c to 6baa156 Compare February 26, 2025 08:58
@mattpap mattpap force-pushed the mattpap/14293_serialize_unstable branch from 6baa156 to 7cd01b6 Compare February 27, 2025 16:21
@mattpap mattpap modified the milestones: 3.7, 3.8 Feb 28, 2025
@mattpap mattpap changed the base branch from branch-3.7 to branch-3.8 March 7, 2025 07:55
@mattpap mattpap modified the milestones: 3.8, 3.9 Aug 26, 2025
@mattpap mattpap changed the base branch from branch-3.8 to branch-3.9 August 29, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default values of list fields in a model are always serialized
2 participants