-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
C-bugSomething isn't workingSomething isn't working
Description
Summary
RustPython function type annotations order does not match Python when accessed via __annotations__
.
This causes problems with e.g. functools singledispatch
which assumes the types in annotations are in order of leftmost parameter to return type. dataclasses
and pydantic
are other libraries which could be affected by this. It this is fixed a lot of importlib tests can be updated to python 3.13 as they have started using singledispatch in Lib/importlib/resources/_common.py.
Sample code
str
parameter and int
return type.
def func(s: str) -> int:
return int(s)
print(func.__annotations__)
Expected
{'s': <class 'str'>, 'return': <class 'int'>}
Actual
{'return': <class 'int'>, 's': <class 'str'>}
Metadata
Metadata
Assignees
Labels
C-bugSomething isn't workingSomething isn't working