classmethod decorations broke in Python 3.9
Opened this issue · 0 comments
FichteFoll commented
Something must have changed with how classmethods function in 3.9.
λ pytest -k test_classmethod
================================================= test session starts =================================================
platform linux -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /home/fichte/code/resumeback
plugins: xonsh-0.9.27
collected 60 items / 58 deselected / 2 selected
tests/test_descriptors.py F. [100%]
====================================================== FAILURES =======================================================
__________________________________________________ test_classmethod ___________________________________________________
def test_classmethod():
ts = State()
class B:
@classmethod
@send_self
def clsmethod(this, cls, param):
yield defer(this.next)
assert cls is B
ts.run = param
b = B()
> wait_until_finished(b.clsmethod(123))
tests/test_descriptors.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
resumeback/__init__.py:371: in __call__
gen_wrapper.next() # Start the first iteration
resumeback/__init__.py:109: in _next
return self._send(generator)
resumeback/__init__.py:147: in _send
return generator.send(value)
resumeback/__init__.py:357: in wrapper
return (yield from self.func(gen_wrapper, *args, **kwargs))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
this = <class 'tests.test_descriptors.test_classmethod.<locals>.B'>
cls = <resumeback.GeneratorWrapper object at 0x7f68d3808430>, param = 123
@classmethod
@send_self
def clsmethod(this, cls, param):
> yield defer(this.next)
E AttributeError: type object 'B' has no attribute 'next'
tests/test_descriptors.py:28: AttributeError
------------------------------------------------ Captured stdout call -------------------------------------------------
<bound method test_classmethod.<locals>.B.clsmethod of <class 'tests.test_descriptors.test_classmethod.<locals>.B'>> (123,)
=============================================== short test summary info ===============================================
FAILED tests/test_descriptors.py::test_classmethod - AttributeError: type object 'B' has no attribute 'next'
===================================== 1 failed, 1 passed, 58 deselected in 0.13s ======================================