Skip to content

attrs.field(converter=None) makes field type Unknown instead of keeping the annotation #5283

Open

Description

@airglide

When an attrs field is annotated (e.g. x: int) and converter=None is passed explicitly, Pyrefly treats the field / synthesized __init__ parameter as Unknown instead of int.

Expected behavior:
converter=None means “no converter” (same as omitting converter, default argument), so the init parameter should still be typed from the field annotation (int).

Minimal Repro

from attrs import define, field

@define
class A:
    x: int = field(converter=None)
p = A("asd")  # should be a type error; currently accepted (field typed as Unknown)

Environment
Pyrefly 1.4
attrs 25.3.0

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