python-attrs fails to build with Python 3.11.0a3. =================================== FAILURES =================================== _______________________ test_init_subclass_vanilla[True] _______________________ slots = True @pytest.mark.parametrize("slots", [True, False]) def test_init_subclass_vanilla(slots): """ `super().__init_subclass__` can be used if the subclass is not an attrs class both with dict and slotted classes. """ @attr.s(slots=slots) class Base: def __init_subclass__(cls, param, **kw): super().__init_subclass__(**kw) cls.param = param > class Vanilla(Base, param="foo"): tests/test_init_subclass.py:27: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ cls = <class 'tests.test_init_subclass.test_init_subclass_vanilla.<locals>.Vanilla'> param = 'foo', kw = {} def __init_subclass__(cls, param, **kw): > super().__init_subclass__(**kw) E TypeError: super(type, obj): obj must be an instance or subtype of type tests/test_init_subclass.py:24: TypeError _____________ TestClosureCellRewriting.test_closure_cell_rewriting _____________ self = <tests.test_slots.TestClosureCellRewriting object at 0x7fb02ec6da50> def test_closure_cell_rewriting(self): """ Slotted classes support proper closure cell rewriting. This affects features like `__class__` and the no-arg super(). """ non_slot_instance = C1(x=1, y="test") slot_instance = C1Slots(x=1, y="test") assert non_slot_instance.my_class() is C1 > assert slot_instance.my_class() is C1Slots E AssertionError: assert <class 'tests.test_slots.C1Slots'> is C1Slots E + where <class 'tests.test_slots.C1Slots'> = <bound method C1Slots.my_class of C1Slots(x=1, y='test')>() E + where <bound method C1Slots.my_class of C1Slots(x=1, y='test')> = C1Slots(x=1, y='test').my_class tests/test_slots.py:424: AssertionError __________________ TestClosureCellRewriting.test_inheritance ___________________ self = <tests.test_slots.TestClosureCellRewriting object at 0x7fb02ec658d0> def test_inheritance(self): """ Slotted classes support proper closure cell rewriting when inheriting. This affects features like `__class__` and the no-arg super(). """ @attr.s class C2(C1): def my_subclass(self): return __class__ @attr.s class C2Slots(C1Slots): def my_subclass(self): return __class__ non_slot_instance = C2(x=1, y="test") slot_instance = C2Slots(x=1, y="test") assert non_slot_instance.my_class() is C1 > assert slot_instance.my_class() is C1Slots E AssertionError: assert <class 'tests.test_slots.C1Slots'> is C1Slots E + where <class 'tests.test_slots.C1Slots'> = <bound method C1Slots.my_class of C2Slots(x=1, y='test')>() E + where <bound method C1Slots.my_class of C2Slots(x=1, y='test')> = C2Slots(x=1, y='test').my_class tests/test_slots.py:451: AssertionError ________________ TestClosureCellRewriting.test_cls_static[True] ________________ self = <tests.test_slots.TestClosureCellRewriting object at 0x7fb02ec71c90> slots = True @pytest.mark.parametrize("slots", [True, False]) def test_cls_static(self, slots): """ Slotted classes support proper closure cell rewriting for class- and static methods. """ # Python can reuse closure cells, so we create new classes just for # this test. @attr.s(slots=slots) class C: @classmethod def clsmethod(cls): return __class__ > assert C.clsmethod() is C @attr.s(slots=slots) E AssertionError: assert <class 'tests.test_slots.TestClosureCellRewriting.test_cls_static.<locals>.C'> is <class 'tests.test_slots.TestClosureCellRewriting.test_cls_static.<locals>.C'> E + where <class 'tests.test_slots.TestClosureCellRewriting.test_cls_static.<locals>.C'> = <bound method TestClosureCellRewriting.test_cls_static.<locals>.C.clsmethod of <class 'tests.test_slots.TestClosureCellRewriting.test_cls_static.<locals>.C'>>() E + where <bound method TestClosureCellRewriting.test_cls_static.<locals>.C.clsmethod of <class 'tests.test_slots.TestClosureCellRewriting.test_cls_static.<locals>.C'>> = <class 'tests.test_slots.TestClosureCellRewriting.test_cls_static.<locals>.C'>.clsmethod tests/test_slots.py:475: AssertionError ____________________ test_slots_super_property_get_shurtcut ____________________ @pytest.mark.skipif(PY2, reason="shortcut super() is PY3-only.") def test_slots_super_property_get_shurtcut(): """ On Python 3, the `super()` shortcut is allowed. """ @attr.s(slots=True) class A(object): x = attr.ib() @property def f(self): return self.x @attr.s(slots=True) class B(A): @property def f(self): return super().f ** 2 > assert B(11).f == 121 tests/test_slots.py:739: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = B(x=11) @property def f(self): > return super().f ** 2 E TypeError: super(type, obj): obj must be an instance or subtype of type tests/test_slots.py:737: TypeError =============================== warnings summary =============================== ../../BUILDROOT/python-attrs-21.4.0-1.fc36.x86_64/usr/lib/python3.11/site-packages/attr/_make.py:918 tests/test_init_subclass.py::test_init_subclass_vanilla[True] tests/test_slots.py::TestClosureCellRewriting::test_cls_static[True] tests/test_slots.py::test_slots_empty_cell tests/test_slots.py::test_slots_super_property_get tests/test_slots.py::test_slots_super_property_get_shurtcut /builddir/build/BUILDROOT/python-attrs-21.4.0-1.fc36.x86_64/usr/lib/python3.11/site-packages/attr/_make.py:918: RuntimeWarning: Running interpreter doesn't sufficiently support code object introspection. Some features like bare super() or accessing __class__ will not work with slotted classes. set_closure_cell(cell, cls) -- Docs: https://docs.pytest.org/en/stable/warnings.html =========================== short test summary info ============================ SKIPPED [1] tests/test_3rd_party.py:14: could not import 'cloudpickle': No module named 'cloudpickle' SKIPPED [1] tests/test_make.py:469: No old-style classes in Py3 SKIPPED [1] tests/test_make.py:1002: PY2-specific keyword-only error behavior SKIPPED [1] tests/test_make.py:1967: Needs to be only caught on Python 2. SKIPPED [1] tests/test_make.py:2333: Pre-3.10 only. SKIPPED [1] tests/test_pyright.py:26: Requires pyright. SKIPPED [1] tests/test_slots.py:485: can't break CodeType.replace() via monkeypatch SKIPPED [1] tests/test_slots.py:532: slots without weakref_slot should only work on PyPy XFAIL tests/test_setattr.py::TestSetAttr::test_slotted_confused FAILED tests/test_init_subclass.py::test_init_subclass_vanilla[True] - TypeEr... FAILED tests/test_slots.py::TestClosureCellRewriting::test_closure_cell_rewriting FAILED tests/test_slots.py::TestClosureCellRewriting::test_inheritance - Asse... FAILED tests/test_slots.py::TestClosureCellRewriting::test_cls_static[True] FAILED tests/test_slots.py::test_slots_super_property_get_shurtcut - TypeErro... ====== 5 failed, 1166 passed, 8 skipped, 1 xfailed, 6 warnings in 19.65s ======= https://docs.python.org/3.11/whatsnew/3.11.html For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/03141508-python-attrs/ For all our attempts to build python-attrs with Python 3.11, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-attrs/ Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11: https://copr.fedorainfracloud.org/coprs/g/python/python3.11/ Let us know here if you have any questions. Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11. A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon. We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.
Reported upstream: https://github.com/python-attrs/attrs/issues/907
Upstream reported the issue to BPO and it's interesting to read: https://bugs.python.org/issue46404
A workaround: https://github.com/python-attrs/attrs/pull/910
The workaround is currently applied in the Python 3.11 COPR and tests are enabled there so we won't miss any possible new incompatibility and we can wait for the final fix.
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle. Changing version to 36.
Ben, does this problem really block other packages? attrs were built without tests first.
(In reply to Miro Hrončok from comment #6) > Ben, does this problem really block other packages? attrs were built without > tests first. As noted in [1], and as I realized after linking the bug, maybe not. I can unblock bug 2099099 until python-jsonpickle is fixed and I can verify whether python-sarif-om has any attrs-related issues or not. [1] https://bugzilla.redhat.com/show_bug.cgi?id=2099099#c4
FEDORA-2022-cc940fb919 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-cc940fb919
FEDORA-2022-cc940fb919 has been pushed to the Fedora 37 stable repository. If problem still persists, please make note of it in this bug report.