Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to 24.1.0 seems to break assignment to fields with chained converters #1327

Closed
leroyvn opened this issue Aug 5, 2024 · 1 comment · Fixed by #1328
Closed

Upgrade to 24.1.0 seems to break assignment to fields with chained converters #1327

leroyvn opened this issue Aug 5, 2024 · 1 comment · Fixed by #1328
Labels

Comments

@leroyvn
Copy link

leroyvn commented Aug 5, 2024

Upon upgrading to v24.1.0, I noticed that some of my code using fields with chained converters raises an AttributeError. Here is a MWE:

import attrs


def foo(x):
    return x


def bar(x):
    return x


@attrs.define
class MyClass:
    field = attrs.field(converter=[foo, bar])


x = MyClass(0)
x.field = 1
print(x)

That code runs successfully with v23.2.0, but it raises with the following stack trace with v24.1.0:

Traceback (most recent call last):
  File "/home/leroyv/Documents/src/rayference/rtm/eradiate/playgrounds/bug_attrs_241.py", line 18, in <module>
    x.field = 1
  File "/home/leroyv/miniforge3/envs/eradiate/lib/python3.9/site-packages/attr/_make.py", line 1057, in __setattr__
    nval = hook(self, a, val)
  File "/home/leroyv/miniforge3/envs/eradiate/lib/python3.9/site-packages/attr/setters.py", line 23, in wrapped_pipe
    rv = setter(instance, attrib, rv)
  File "/home/leroyv/miniforge3/envs/eradiate/lib/python3.9/site-packages/attr/setters.py", line 66, in convert
    return c(new_value)
AttributeError: __call__
@hynek
Copy link
Member

hynek commented Aug 5, 2024

yeah this is really bad, #1328 should fix it

@hynek hynek linked a pull request Aug 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants