@@ -654,15 +654,21 @@ When calling the wrapped function in the decorator wrapper function, the
654654instance is already bound to ``wrapped `` and will be passed automatically
655655as the first argument to the original wrapped function.
656656
657- Note that due to a bug in ``classmethod.__get__() `` prior to Python 3.9,
658- whereby it does not apply the descriptor protocol to the function wrapped
659- by ``@classmethod ``, the above only applies where the decorator wraps the
660- ``@classmethod `` decorator. If the decorator is placed inside of the
661- ``@classmethod `` decorator, then ``instance `` will be ``None `` and the
662- decorator wrapper function will see the call as being the same as a normal
663- function. As a result, always place any decorator outside of the
664- ``@classmethod `` decorator if needing the code to be portable to versions
665- of Python older than Python 3.9.
657+ Note that you should always apply the decorator outside of the ``@classmethod ``
658+ decorator. This is because the ``@classmethod `` decorator itself is not
659+ aware of the descriptor protocol for the function it is wrapping, and so
660+ it does not apply it. If the decorator is placed inside of the ``@classmethod ``
661+ decorator, then ``instance `` will be ``None `` and the decorator wrapper function
662+ will see the call as being the same as a normal function.
663+
664+ This behavour of ``@classmethod `` is a bug in it's ``classmethod.__get__() ``
665+ implementation. The bug existed prior to Python 3.9 and was fixed in that
666+ version of Python, however in Python 3.13 this fix in Python was reverted back
667+ to the old behaviour because various third party code relied on the broken
668+ behaviour and even though technically not correct, it was deemed safer to revert
669+ the fix. Thus the general recommendation remains that decorators implemented
670+ using ``@wrapt.decorator `` always be placed outside of ``@classmethod `` and
671+ never inside.
666672
667673Decorating Static Methods
668674-------------------------
0 commit comments