-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Compatibility with Python 3.11 #907
Comments
@frenzymadness should we raise this on the Python side? They're breaking code that works on previous versions. The code is very black magic though. |
I haven't had time to investigate it more. If you think those are bugs in Python, then yes, open issues for them. From a quick look, I don't see anything related to this in the changelog. |
Link to BPO: https://bugs.python.org/issue46404 |
Thank you very much for the upstream report. It's interesting reading. |
As I mentioned in the bug in Python upstream, I'd like to make this situation more stable which means to implement the fix you have here for dataclasses and test it in Python so every future change in behavior of I'm able to reproduce the problem with property: @dataclasses.dataclass(slots=True)
class A:
@property
def prop(self):
return __class__
a = A()
print(a.prop) and also with inheritance and arg-less call to @dataclasses.dataclass(slots=True)
class A:
pass
@dataclasses.dataclass(slots=True)
class B(A):
def test(self):
super()
b = B()
b.test() but the same problem should appear in import dataclasses
@dataclasses.dataclass(slots=True)
class A:
@classmethod
def class_method(self):
return __class__
a = A()
a.class_method() And it works fine in both 3.11 and 3.10 without any fixes. You seem to understand the problem very well so I thought you might know how to reproduce the third use case. |
@vstinner could you please help me here. Are classmethods and staticmethods something we should care about here or not? |
I created https://bugs.python.org/issue47143 "Add functools.copy_class() which updates closures". |
@vstinner That would be great! |
Unfortunately, it seems that it's not easily doable to implement such general-purpose function in Python, see the reasons mentioned in the last comment: python/cpython#91299 (comment) We'll probably have to keep the code in attrs with all the branches for older and newer Pythons. |
With 3.11.0b1, I see even more test failures:
Full log: |
Just linking another PR: #969 |
fixed by #969 |
Great, thanks! |
But still support older attrs versions on older Python versions Thank-you-to: James Gerity @SnoopJ Reference: python-attrs/attrs#907 Reference: python-attrs/attrs#969 Reference: #3199 (comment) Signed-off-by: Philippe Ombredanne <[email protected]>
Hello.
In Fedora, we are again trying to prepare the new Python 3.11 soon and during the rebuild of our packages, we have discovered that some tests of attrs package fail:
We are building attrs 21.4.0 together with Python 3.11.0~a3 (changelog)
The text was updated successfully, but these errors were encountered: