-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
bpo-43224: Draft implementation of PEP 646 #30398
Commits on Jan 2, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 64abc0a - Browse repository at this point
Copy the full SHA 64abc0aView commit details
Commits on Jan 3, 2022
-
Configuration menu - View commit details
-
Copy full SHA for b725671 - Browse repository at this point
Copy the full SHA b725671View commit details -
PEP 646: Add AST tests for *args annotations
Formatted, the generated AST is as follows. `def f(*args: *Ts): pass`: ``` ( "Module", [ ( "FunctionDef", (1, 0, 1, 23), "f", ( "arguments", [], [], ( "arg", (1, 7, 1, 16), "args", ( "Starred", (1, 13, 1, 16), ("Name", (1, 14, 1, 16), "Ts", ("Load",)), ("Load",), ), None, ), [], [], None, [], ), [("Pass", (1, 19, 1, 23))], [], None, None, ) ], [], ) ``` `def f(*args: *tuple[int, ...]): pass`: ``` ( "Module", [ ( "FunctionDef", (1, 0, 1, 36), "f", ( "arguments", [], [], ( "arg", (1, 7, 1, 29), "args", ( "Starred", (1, 13, 1, 29), ( "Subscript", (1, 14, 1, 29), ("Name", (1, 14, 1, 19), "tuple", ("Load",)), ( "Tuple", (1, 20, 1, 28), [ ("Name", (1, 20, 1, 23), "int", ("Load",)), ("Constant", (1, 25, 1, 28), Ellipsis, None), ], ("Load",), ), ("Load",), ), ("Load",), ), None, ), [], [], None, [], ), [("Pass", (1, 32, 1, 36))], [], None, None, ) ], [], ) ``` `def f(*args: *tuple[int, *Ts]): pass`: ``` ( "Module", [ ( "FunctionDef", (1, 0, 1, 36), "f", ( "arguments", [], [], ( "arg", (1, 7, 1, 29), "args", ( "Starred", (1, 13, 1, 29), ( "Subscript", (1, 14, 1, 29), ("Name", (1, 14, 1, 19), "tuple", ("Load",)), ( "Tuple", (1, 20, 1, 28), [ ("Name", (1, 20, 1, 23), "int", ("Load",)), ( "Starred", (1, 25, 1, 28), ("Name", (1, 26, 1, 28), "Ts", ("Load",)), ("Load",), ), ], ("Load",), ), ("Load",), ), ("Load",), ), None, ), [], [], None, [], ), [("Pass", (1, 32, 1, 36))], [], None, None, ) ], [], ) ```
Configuration menu - View commit details
-
Copy full SHA for ea329b9 - Browse repository at this point
Copy the full SHA ea329b9View commit details -
PEP 646: Add AST tests for return types with unpacking
Formatted, generated AST is as follows. `def f() -> tuple[*Ts]: pass`: ``` ( "Module", [ ( "FunctionDef", (1, 0, 1, 27), "f", ("arguments", [], [], None, [], [], None, []), [("Pass", (1, 23, 1, 27))], [], ( "Subscript", (1, 11, 1, 21), ("Name", (1, 11, 1, 16), "tuple", ("Load",)), ( "Tuple", (1, 17, 1, 20), [ ( "Starred", (1, 17, 1, 20), ("Name", (1, 18, 1, 20), "Ts", ("Load",)), ("Load",), ) ], ("Load",), ), ("Load",), ), None, ) ], [], ) ``` `def f() -> tuple[int, *Ts]: pass`: ``` ( "Module", [ ( "FunctionDef", (1, 0, 1, 32), "f", ("arguments", [], [], None, [], [], None, []), [("Pass", (1, 28, 1, 32))], [], ( "Subscript", (1, 11, 1, 26), ("Name", (1, 11, 1, 16), "tuple", ("Load",)), ( "Tuple", (1, 17, 1, 25), [ ("Name", (1, 17, 1, 20), "int", ("Load",)), ( "Starred", (1, 22, 1, 25), ("Name", (1, 23, 1, 25), "Ts", ("Load",)), ("Load",), ), ], ("Load",), ), ("Load",), ), None, ) ], [], ) ``` `def f() -> tuple[int, *tuple[int, ...]]: pass`: ``` ( "Module", [ ( "FunctionDef", (1, 0, 1, 45), "f", ("arguments", [], [], None, [], [], None, []), [("Pass", (1, 41, 1, 45))], [], ( "Subscript", (1, 11, 1, 39), ("Name", (1, 11, 1, 16), "tuple", ("Load",)), ( "Tuple", (1, 17, 1, 38), [ ("Name", (1, 17, 1, 20), "int", ("Load",)), ( "Starred", (1, 22, 1, 38), ( "Subscript", (1, 23, 1, 38), ("Name", (1, 23, 1, 28), "tuple", ("Load",)), ( "Tuple", (1, 29, 1, 37), [ ("Name", (1, 29, 1, 32), "int", ("Load",)), ("Constant", (1, 34, 1, 37), Ellipsis, None), ], ("Load",), ), ("Load",), ), ("Load",), ), ], ("Load",), ), ("Load",), ), None, ) ], [], ) ```
Configuration menu - View commit details
-
Copy full SHA for 681dc4e - Browse repository at this point
Copy the full SHA 681dc4eView commit details -
PEP 646: Add AST tests for variable annotations with unpacking
Formatted, generated AST is as follows: `x: tuple[*Ts]`: ``` ( "Module", [ ( "AnnAssign", (1, 0, 1, 13), ("Name", (1, 0, 1, 1), "x", ("Store",)), ( "Subscript", (1, 3, 1, 13), ("Name", (1, 3, 1, 8), "tuple", ("Load",)), ( "Tuple", (1, 9, 1, 12), [ ( "Starred", (1, 9, 1, 12), ("Name", (1, 10, 1, 12), "Ts", ("Load",)), ("Load",), ) ], ("Load",), ), ("Load",), ), None, 1, ) ], [], ) ``` `x: tuple[int, *Ts]`: ``` ( "Module", [ ( "AnnAssign", (1, 0, 1, 18), ("Name", (1, 0, 1, 1), "x", ("Store",)), ( "Subscript", (1, 3, 1, 18), ("Name", (1, 3, 1, 8), "tuple", ("Load",)), ( "Tuple", (1, 9, 1, 17), [ ("Name", (1, 9, 1, 12), "int", ("Load",)), ( "Starred", (1, 14, 1, 17), ("Name", (1, 15, 1, 17), "Ts", ("Load",)), ("Load",), ), ], ("Load",), ), ("Load",), ), None, 1, ) ], [], ) ``` `x: tuple[int, *tuple[str, ...]]`: ``` ( "Module", [ ( "AnnAssign", (1, 0, 1, 31), ("Name", (1, 0, 1, 1), "x", ("Store",)), ( "Subscript", (1, 3, 1, 31), ("Name", (1, 3, 1, 8), "tuple", ("Load",)), ( "Tuple", (1, 9, 1, 30), [ ("Name", (1, 9, 1, 12), "int", ("Load",)), ( "Starred", (1, 14, 1, 30), ( "Subscript", (1, 15, 1, 30), ("Name", (1, 15, 1, 20), "tuple", ("Load",)), ( "Tuple", (1, 21, 1, 29), [ ("Name", (1, 21, 1, 24), "str", ("Load",)), ("Constant", (1, 26, 1, 29), Ellipsis, None), ], ("Load",), ), ("Load",), ), ("Load",), ), ], ("Load",), ), ("Load",), ), None, 1, ) ], [], ) ```
Configuration menu - View commit details
-
Copy full SHA for 69f575f - Browse repository at this point
Copy the full SHA 69f575fView commit details -
PEP 646: Add support for starring tuple types
E.g. tuple[*tuple[int, str]].
Configuration menu - View commit details
-
Copy full SHA for 095a620 - Browse repository at this point
Copy the full SHA 095a620View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6713748 - Browse repository at this point
Copy the full SHA 6713748View commit details -
Configuration menu - View commit details
-
Copy full SHA for 038b8f0 - Browse repository at this point
Copy the full SHA 038b8f0View commit details -
Configuration menu - View commit details
-
Copy full SHA for f028339 - Browse repository at this point
Copy the full SHA f028339View commit details
Commits on Jan 4, 2022
-
PEP 646: Add tests for typing.get_{origin,args}
and fix a couple of bugs the tests revealed
Configuration menu - View commit details
-
Copy full SHA for 38c17d3 - Browse repository at this point
Copy the full SHA 38c17d3View commit details
Commits on Jan 15, 2022
-
PEP 646: Various fixes to genericaliasobject.c
Based on Fidget-Spinner's feedback: 1. Remove the explicit flag for 'exhausted', instead using 'gi->obj == NULL' to tell whether the iterator is exhausted. 2. Construct `starred_tuple` using the `Py_GenericAlias` constructor instead of constructing it manually. 3. Fix reference counting. 4. Make `Py_GenericAliasIterType` static.
Configuration menu - View commit details
-
Copy full SHA for 9991937 - Browse repository at this point
Copy the full SHA 9991937View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9017d22 - Browse repository at this point
Copy the full SHA 9017d22View commit details
Commits on Jan 17, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 07ed599 - Browse repository at this point
Copy the full SHA 07ed599View commit details
Commits on Jan 20, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 74e5252 - Browse repository at this point
Copy the full SHA 74e5252View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6cb3aa5 - Browse repository at this point
Copy the full SHA 6cb3aa5View commit details -
Configuration menu - View commit details
-
Copy full SHA for daef59b - Browse repository at this point
Copy the full SHA daef59bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3c2a7e7 - Browse repository at this point
Copy the full SHA 3c2a7e7View commit details
Commits on Jan 25, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 456156a - Browse repository at this point
Copy the full SHA 456156aView commit details