Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mypyc] Support Python 3.12 type alias syntax (PEP 695) #17384

Merged
merged 13 commits into from
Jun 17, 2024
Prev Previous commit
Next Next commit
Add docstring
  • Loading branch information
JukkaL committed Jun 14, 2024
commit 651031923758f039ff339a535dae0e382a14ae79
8 changes: 8 additions & 0 deletions mypyc/irbuild/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,14 @@ def get_call_target_fullname(ref: RefExpr) -> str:
def create_type_params(
builder: IRBuilder, typing_mod: Value, type_args: list[TypeParam], line: int
) -> list[Value]:
"""Create objects representing various kinds of Python 3.12 type parameters.

The "typing_mod" argument is the "_typing" module object. The type objects
are looked up from it.

The returned list has one item for each "type_args" item, in the same order.
Each item is either a TypeVar, TypeVarTuple or ParamSpec instance.
"""
tvs = []
type_var_imported: Value | None = None
for type_param in type_args:
Expand Down