Alex Waygood <[email protected]> added the comment:
Happily, this bug appears to have been resolved in Python 3.10 due to the fact
that a `classmethod` wrapping a function `F` will now have an `__annotations__`
dict equal to `F`.
In Python 3.9:
```
>>> x = lambda y: y
>>> x.__annotations__ = {'y': int}
>>> c = classmethod(x)
>>> c.__annotations__
Traceback (most recent call last):
File "<pyshell#37>", line 1, in <module>
c.__annotations__
AttributeError: 'classmethod' object has no attribute '__annotations__'
```
In Python 3.10:
```
x = lambda y: y
x.__annotations__ = {'y': int}
c = classmethod(x)
c.__annotations__
{'y': <class 'int'>}
```
This change appears to have resolved the bug in
`functools.singledispatchmethod`. The bug remains in Python 3.9, however.
----------
nosy: +AlexWaygood
versions: -Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39679>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com