Skip to content

@<field>.converter decorator is not recognized; converter input type is ignored for __init__ #4123

Description

@shobhitmehro
import attrs
@attrs.define
class DecoratorConverter:
    x: int = attrs.field()

    @x.converter
    def _to_int(self, val: str | float) -> int:
        return int(val)


# XXX: fails
# DecoratorConverter("foo")

feature in attrs version 26.2.0 (unreleased)

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions