Skip to content

@autofields does not take definition order into account #76

Closed

Description

@smarie

Consider this:

from pyfields import autofields, get_fields

@autofields
class Foo:
    c: int
    b: str = "hello"

get_fields(Foo)  # <-- (<NativeField: Foo.b>, <NativeField: Foo.c>)

So the order in which the fields are returned is wrong.

Activity

  1. added
    bug
    on Sep 22, 2020
  2. smarie commented on Sep 22, 2020

    @smarie
    OwnerAuthor

    After investigating, this bug only happens when there are attributes that do not have default values (only an annotation).

  3. reopened this on Sep 22, 2020
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions