Skip to content

slots=True is incompatible with str=True #198

@rouge8

Description

@rouge8

slots=True seems to be incompatible with str=True. I discovered this using attrs for exceptions, but it seems true in general:

>>> import attr
>>> @attr.s(str=True, slots=True)
... class Foo(object):
...     x = attr.ib()
...
>>> f = Foo(1)
>>> str(f)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unbound method repr_() must be called with Foo instance as first argument (got nothing instead)

Python 2.7.13, attrs==17.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions