Message409340
I can verify that this happens on `3.10` and `main` branches:
```
from typing import Annotated, Optional, get_type_hints
class Foo:
def __init__(self, x: Annotated[Optional[str], "d"] = None): ...
class Foo2:
x: Annotated[Optional[str], "d"] = None
print(get_type_hints(Foo.__init__, include_extras=False)) # ok
# {'x': typing.Optional[str]}
print(get_type_hints(Foo2, include_extras=False)) # ok
# {'x': typing.Optional[str]}
print(get_type_hints(Foo.__init__, include_extras=True)) # not ok?
# {'x': typing.Optional[typing.Annotated[typing.Optional[str], 'd']]}
print(get_type_hints(Foo2, include_extras=True)) # ok
# {'x': typing.Annotated[typing.Optional[str], 'd']}
```
Notice that 3rd case does not look correct: `{'x': typing.Optional[typing.Annotated[typing.Optional[str], 'd']]}`
In my opinion it should be `{'x': typing.Annotated[typing.Optional[str], 'd']}`
I will look into it! :) |
|
| Date |
User |
Action |
Args |
| 2021-12-30 00:38:12 | sobolevn | set | recipients:
+ sobolevn, gvanrossum, kj, med2277 |
| 2021-12-30 00:38:12 | sobolevn | set | messageid: <1640824692.62.0.382788886032.issue46195@roundup.psfhosted.org> |
| 2021-12-30 00:38:12 | sobolevn | link | issue46195 messages |
| 2021-12-30 00:38:12 | sobolevn | create | |
|